ar71xx: simplify patch 613 and add missing error handling

Dynamic allocation of label can be simplified.
Also add error handling to deal with failed memory allocation.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

SVN-Revision: 49244
This commit is contained in:
John Crispin 2016-04-26 11:43:42 +00:00
parent 301d48b8f0
commit 69a368cf7e
2 changed files with 6 additions and 6 deletions

View file

@ -18,12 +18,12 @@
+static int ath79_request_ext_lna_gpio(unsigned chain, int gpio)
+{
+ char buf[32];
+ char *label;
+ int err;
+
+ scnprintf(buf, sizeof(buf), "external LNA%u", chain);
+ label = kstrdup(buf, GFP_KERNEL);
+ label = kasprintf(GFP_KERNEL, "external LNA%u", chain);
+ if (!label)
+ return -ENOMEM;
+
+ err = gpio_request_one(gpio, GPIOF_DIR_OUT | GPIOF_INIT_LOW, label);
+ if (err) {

View file

@ -18,12 +18,12 @@
+static int ath79_request_ext_lna_gpio(unsigned chain, int gpio)
+{
+ char buf[32];
+ char *label;
+ int err;
+
+ scnprintf(buf, sizeof(buf), "external LNA%u", chain);
+ label = kstrdup(buf, GFP_KERNEL);
+ label = kasprintf(GFP_KERNEL, "external LNA%u", chain);
+ if (!label)
+ return -ENOMEM;
+
+ err = gpio_request_one(gpio, GPIOF_DIR_OUT | GPIOF_INIT_LOW, label);
+ if (err) {