summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-10-04 01:52:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-24 10:23:27 +0300
commit4d7ddcdbdf436932493274073efac62ec2523868 (patch)
treedaa33da3bd9210e50822b0424f44b77c84749f70
parentf1dda24adacd9fc99764a8767c927d3d33e630fc (diff)
downloadlinux-4d7ddcdbdf436932493274073efac62ec2523868.tar.xz
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>
-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;
}