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>
Mon, 25 Nov 2019 08:53:48 +0000 (09:53 +0100)
commit054bdd2855a3b8319390870613017cc97dda710b
tree7f70133351629749b4dcb383382052eec7f2a777
parentad04aadb0bc923519820c8132b20911e7ef0e78b
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