diff options
author | Sam Ravnborg <srn@skov.dk> | 2017-07-03 22:07:41 +0200 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2017-07-07 14:37:59 +0200 |
commit | 3401a62343a5068c9948c81390c3781d866ada54 (patch) | |
tree | 3a2cfded429a5c9510cc5d09cee5a79e3b72b868 /common/state | |
parent | 90b0100ad82343fd7cd2bd08e5147959d2da2e2c (diff) | |
download | barebox-3401a62343a5068c9948c81390c3781d866ada54.tar.gz barebox-3401a62343a5068c9948c81390c3781d866ada54.tar.xz |
gpio: fix null pointer exception when there is no oftree
In a system with oftree support enabled but with no oftree the
of_gpiochip_scan_hogs() would fail due to device_node equals NULL.
Check device_node and return with 0 in this situation, as this
mirrors what would have happened before we added support for gpio-hogs.
Use IS_ENABLED(CONFIG_OFDEVICE) to teach compiler to leave
out the of_* specific functions if not needed.
Fixes: 37e6bee7 ("gpiolib: Add support for GPIO "hog" nodes")
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'common/state')
0 files changed, 0 insertions, 0 deletions