]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ethernet: adi: adin1110: Check return value of devm_gpiod_get_optional() in...
authorChen Ni <nichen@iscas.ac.cn>
Mon, 2 Feb 2026 04:02:28 +0000 (12:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Feb 2026 12:41:58 +0000 (13:41 +0100)
commit9f42cb8fafd6d2ec312e55def88117b555d330e2
tree4c89f884d401c23793b582f55f6e26fe6031e463
parent100f3bf91461285f2c155f5e9e883668c85e6627
net: ethernet: adi: adin1110: Check return value of devm_gpiod_get_optional() in adin1110_check_spi()

[ Upstream commit 78211543d2e44f84093049b4ef5f5bfa535f4645 ]

The devm_gpiod_get_optional() function may return an ERR_PTR in case of
genuine GPIO acquisition errors, not just NULL which indicates the
legitimate absence of an optional GPIO.

Add an IS_ERR() check after the call in adin1110_check_spi(). On error,
return the error code to ensure proper failure handling rather than
proceeding with invalid pointers.

Fixes: 36934cac7aaf ("net: ethernet: adi: adin1110: add reset GPIO")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20260202040228.4129097-1-nichen@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/adi/adin1110.c