From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E51E285060; Mon, 9 Feb 2026 14:33:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647596; cv=none; b=orL7pi1vccJA6e+u7WZjY/tVbrdvsItz27MUgQxpAB6lHDz35KmhvbPm5+H2f8aaIkZwPkVKUXGxfbAKPkDa2H8Z11YInrHytD+kKzv5x4i3biMOvWMRQTzSVehlqBkZJBdhSTuQHYQR+LiM3L/X/Kh5PohVSDvAMVAofvqwqYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647596; c=relaxed/simple; bh=jiaKetmqMkW3sklFtmhEhf/EQDkEA4l3OdLA+zdNRyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cC+Xx6Nw10VSt3xF9s5QULBGmIaO6ADOB+Zr5Tr+fTY8E4WPPxa2XfaQWcOJ4Jc3wFydLm7/cL+s2qb3aFDwah2qP3G+NZwJW5OtDXuSZPPYjSpRFU7kh1Ayk1KdvRaBGtSdogrm6IlQCHr8uZihKRx1X9yoN6ZRvfNG0UR5H4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F9Lz5+2X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="F9Lz5+2X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CEDEC116C6; Mon, 9 Feb 2026 14:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770647596; bh=jiaKetmqMkW3sklFtmhEhf/EQDkEA4l3OdLA+zdNRyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9Lz5+2XMxygeSmepZpa71k/nEVSSDUU8PV0sO8AR81HxLP+sseCHl5b0VMDzOaau aOwiFh0RiNCj47sEvdoh9BCYURyafov5PUC9imspnD3b9DwttUfMjE6yhBUsmiS8FL YYCyLzik4ZR38R7rwz5ZByKzRWH4+md9oIkRLInI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chen Ni , =?UTF-8?q?Nuno=20S=C3=A1?= , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 147/175] net: ethernet: adi: adin1110: Check return value of devm_gpiod_get_optional() in adin1110_check_spi() Date: Mon, 9 Feb 2026 15:23:40 +0100 Message-ID: <20260209142325.791894729@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142320.474120190@linuxfoundation.org> References: <20260209142320.474120190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Ni [ 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 Reviewed-by: Nuno Sá Link: https://patch.msgid.link/20260202040228.4129097-1-nichen@iscas.ac.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/adi/adin1110.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c index 30f9d271e5953..71a2397edf2bb 100644 --- a/drivers/net/ethernet/adi/adin1110.c +++ b/drivers/net/ethernet/adi/adin1110.c @@ -1089,6 +1089,9 @@ static int adin1110_check_spi(struct adin1110_priv *priv) reset_gpio = devm_gpiod_get_optional(&priv->spidev->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) + return dev_err_probe(&priv->spidev->dev, PTR_ERR(reset_gpio), + "failed to get reset gpio\n"); if (reset_gpio) { /* MISO pin is used for internal configuration, can't have * anyone else disturbing the SDO line. -- 2.51.0