iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe()
authorZhang Shurong <zhang_shurong@foxmail.com>
Sat, 15 Jul 2023 15:55:50 +0000 (23:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:19:45 +0000 (17:19 +0000)
commit5b82e4240533bcd4691e50b64ec86d0d7fbd21b9
tree7393d52864a981d4ff4da01880fe56a61b796083
parent6b1e61f7d07044563c497ea7320eb5c7ec446860
iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe()

[ Upstream commit 3a23b384e7e3d64d5587ad10729a34d4f761517e ]

of_match_device() may fail and returns a NULL pointer.

In practice there is no known reasonable way to trigger this, but
in case one is added in future, harden the code by adding the check

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Link: https://lore.kernel.org/r/tencent_994DA85912C937E3B5405BA960B31ED90A08@qq.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/stm32-adc-core.c