aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2018-05-07 12:07:32 +0200
committerJohn Crispin <john@phrozen.org>2018-05-24 22:11:55 +0200
commit050da2107a7eb2a571a8a3d0cee21cc6a44b72b8 (patch)
tree147c3b85ccae12e4b1659acd86ac93b13ecfa15d /target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch
parent4f67c1522d92bc4512c3ecf58c38ff9886530b48 (diff)
downloadupstream-050da2107a7eb2a571a8a3d0cee21cc6a44b72b8.tar.gz
upstream-050da2107a7eb2a571a8a3d0cee21cc6a44b72b8.tar.bz2
upstream-050da2107a7eb2a571a8a3d0cee21cc6a44b72b8.zip
mediatek: backport upstream mediatek patches
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch')
-rw-r--r--target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch b/target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch
new file mode 100644
index 0000000000..a71af5005c
--- /dev/null
+++ b/target/linux/mediatek/patches-4.14/0194-pinctrl-mediatek-mt7622-fix-potential-uninitialized-.patch
@@ -0,0 +1,54 @@
+From cfcb2cc358f3ff466d4c419d8f6fe0263bdc47b1 Mon Sep 17 00:00:00 2001
+From: Sean Wang <sean.wang@mediatek.com>
+Date: Wed, 10 Jan 2018 00:28:24 +0800
+Subject: [PATCH 194/224] pinctrl: mediatek: mt7622: fix potential
+ uninitialized value being returned
+
+commit d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622
+SoC") leads to the following static checker warning:
+
+drivers/pinctrl/mediatek/pinctrl-mt7622.c:1419 mtk_gpio_get()
+error: uninitialized symbol 'value'.
+1412 static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
+1413 {
+1414 struct mtk_pinctrl *hw = dev_get_drvdata(chip->parent);
+1415 int value;
+1416
+1417 mtk_hw_get_value(hw, gpio, PINCTRL_PIN_REG_DI, &value);
+^^^^^^^^^^^^^^^^
+1418
+1419 return !!value;
+1420 }
+
+The appropriate error handling must be added to avoid the potential error
+caused by uninitialized value being returned.
+
+Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Sean Wang <sean.wang@mediatek.com>
+Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ drivers/pinctrl/mediatek/pinctrl-mt7622.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+index 3824d82888ac..dc32e3c3bd73 100644
+--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
++++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+@@ -1412,9 +1412,11 @@ static struct pinctrl_desc mtk_desc = {
+ static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
+ {
+ struct mtk_pinctrl *hw = dev_get_drvdata(chip->parent);
+- int value;
++ int value, err;
+
+- mtk_hw_get_value(hw, gpio, PINCTRL_PIN_REG_DI, &value);
++ err = mtk_hw_get_value(hw, gpio, PINCTRL_PIN_REG_DI, &value);
++ if (err)
++ return err;
+
+ return !!value;
+ }
+--
+2.11.0
+