From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0F7B13F9267; Wed, 20 May 2026 18:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301014; cv=none; b=u/YDWqvC206OesMndJwBNsocW9KhH1OVLe6Z91NmXx5EtFPGOv+FpTzGrSy00FUjWDfhYrd0eR+7JBptP6PxOcT/nQYTRS1dEYsIaFpc/2B+imJhoDfHmJYNYAhu/aQqhVAHBuinSdo4YI3alRFOTdhd95Tbne+D6/JpLAP82PA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301014; c=relaxed/simple; bh=X4I5baesOoKOafrJTjTnhqUB0YaMvLDfN0NHuaZ2n8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LWMdHSFKLI4USAG1Zx+hMTeeQnIasodyy5jP5yz2+jut7dZrR3llZ0EmaM8OFgbnLpzni0inTHGq+2Qa29ajN5NehMjnok6Z/wVcnzVmQAu81GQu/ICcJfBP4asmjoNmfmhDrA/jPKhEERt2mrSi2OShLjymslZefyvphHnu1EM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y9lc4wWp; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Y9lc4wWp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F6AB1F000E9; Wed, 20 May 2026 18:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301012; bh=NmtmOLlr7qpsSM7s0DY8S93tpkUTNM9772/VWuYzP+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y9lc4wWpGo7d8J/SjYmItKz86ScmdGzZDKmhscweFYAmUKJT94kQK8BYLTnrgFR1u Qu7HUHnqoPqOpUlOx1DX7Sidh2BAOUA1wUV4YtTMWW200ohYGkH3MB55rM4DULOSgL h/dh5qGp7Lwxh+enUsFEQog/o7bK7EyfWRwBYwZs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chen Ni , Linus Walleij , "Daniel Thompson (RISCstar)" , Lee Jones , Sasha Levin Subject: [PATCH 6.12 386/666] backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt() Date: Wed, 20 May 2026 18:19:57 +0200 Message-ID: <20260520162119.621372201@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Ni [ Upstream commit 797cc011ae02bda26f93d25a4442d7a1a77d84df ] 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 sky81452_bl_parse_dt(). On error, return the error code to ensure proper failure handling rather than proceeding with invalid pointers. Fixes: e1915eec54a6 ("backlight: sky81452: Convert to GPIO descriptors") Signed-off-by: Chen Ni Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson (RISCstar) Link: https://patch.msgid.link/20260203021625.578678-1-nichen@iscas.ac.cn Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/sky81452-backlight.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c index 935043b677869..3a5ff1b6f4327 100644 --- a/drivers/video/backlight/sky81452-backlight.c +++ b/drivers/video/backlight/sky81452-backlight.c @@ -202,6 +202,9 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( pdata->dpwm_mode = of_property_read_bool(np, "skyworks,dpwm-mode"); pdata->phase_shift = of_property_read_bool(np, "skyworks,phase-shift"); pdata->gpiod_enable = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH); + if (IS_ERR(pdata->gpiod_enable)) + return dev_err_cast_probe(dev, pdata->gpiod_enable, + "failed to get gpio\n"); ret = of_property_count_u32_elems(np, "led-sources"); if (ret < 0) { -- 2.53.0