OSDN Git Service

gpio: syscon: Fix possible NULL ptr usage
authorMarek Vasut <marex@denx.de>
Wed, 3 Oct 2018 22:52:52 +0000 (00:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:20:54 +0000 (08:20 +0100)
commit07ed61a0a711bf7b2c91041a332ec5a4035689cb
tree24adf3239cb34670e930a63c370ca7722f3b2e66
parent312de5a09d10d15984082b5c3e9e5e358386f51a
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>
drivers/gpio/gpio-syscon.c