summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-10-04 00:52:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-25 09:53:48 +0100
commit054bdd2855a3b8319390870613017cc97dda710b (patch)
tree7f70133351629749b4dcb383382052eec7f2a777 /drivers/gpio
parentad04aadb0bc923519820c8132b20911e7ef0e78b (diff)
downloadlinux-stable-054bdd2855a3b8319390870613017cc97dda710b.tar.gz
linux-stable-054bdd2855a3b8319390870613017cc97dda710b.tar.bz2
linux-stable-054bdd2855a3b8319390870613017cc97dda710b.zip
gpio: syscon: Fix possible NULL ptr usage
[ Upstream commit 70728c29465bc4bfa7a8c14304771eab77e923c7 ] The priv->data->set can be NULL while flags contains GPIO_SYSCON_FEAT_OUT and chip->set is valid pointer. This happens in case the controller uses the default GPIO setter. Always use chip->set to access the setter to avoid possible NULL pointer dereferencing. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-syscon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 537cec7583fc..cf88a0bfe99e 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -122,7 +122,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val)
BIT(offs % SYSCON_REG_BITS));
}
- priv->data->set(chip, offset, val);
+ chip->set(chip, offset, val);
return 0;
}