summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2016-04-26 11:43:42 +0000
committerJohn Crispin <john@openwrt.org>2016-04-26 11:43:42 +0000
commit69a368cf7e1906d874e190031787b4dcb4493add (patch)
tree52146d04e77056480297ec0d6f5d333fc9d407eb /target/linux
parent301d48b8f03c7460efac50007154ab2426db188a (diff)
downloadmtk-20170518-69a368cf7e1906d874e190031787b4dcb4493add.zip
mtk-20170518-69a368cf7e1906d874e190031787b4dcb4493add.tar.gz
mtk-20170518-69a368cf7e1906d874e190031787b4dcb4493add.tar.bz2
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
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch6
-rw-r--r--target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch6
2 files changed, 6 insertions, 6 deletions
diff --git a/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch b/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
index a832bf8..e8bbe44 100644
--- a/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
+++ b/target/linux/ar71xx/patches-4.1/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
@@ -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) {
diff --git a/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch b/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
index a832bf8..e8bbe44 100644
--- a/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
+++ b/target/linux/ar71xx/patches-4.4/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch
@@ -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) {