Author: blogic
Date: 2016-04-26 13:43:42 +0200 (Tue, 26 Apr 2016)
New Revision: 49244

Modified:
   
trunk/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
   
trunk/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
Log:
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 <[email protected]>

Modified: 
trunk/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
===================================================================
--- 
trunk/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
 2016-04-26 11:43:38 UTC (rev 49243)
+++ 
trunk/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
 2016-04-26 11:43:42 UTC (rev 49244)
@@ -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) {

Modified: 
trunk/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
===================================================================
--- 
trunk/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
 2016-04-26 11:43:38 UTC (rev 49243)
+++ 
trunk/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
 2016-04-26 11:43:42 UTC (rev 49244)
@@ -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) {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to