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 1B4173D75D3; Wed, 20 May 2026 17:39:53 +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=1779298796; cv=none; b=o29fcXC74IxzqOF9rGKJ+sLjrfbCUVMXV5i66Twnr59U3xyBwif6u/f6ecm5NSXeUUUdeY3fubVFNiAI6geMdEZAy8GJRvbdzEjzXgOrelYCmIuWWA3mUFdM3nn6o+IKSKkxjVhRvn8Y2Oj94p56lBe8tE815CZcODTAo8xBOc4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298796; c=relaxed/simple; bh=mfQVKMLjaOLEaIWe7xtvEEkXmsMZ3oZPxMuk+x4nSVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X79ILM0BV7zFmAGzey6egEyLHcAq1gZnnRVNIo3WRmOayMuOop3OiFIa/H2EnBG93/nVZD7SmAXi0ZB7FtqnZvg5T4j2zkv9qTTJUFwGP0c7DvlI4r6kDHn73wkFBBClK/hkyDZfxi9erlwkPQNYoilNn2f0NNNDLfB5McJKIac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mBKt/SBN; 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="mBKt/SBN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D13161F000E9; Wed, 20 May 2026 17:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779298793; bh=XE3j8vGt+PA3kuVOU/xJh1K7yu2Ump0WLLY/6LDoyKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mBKt/SBNYaKWWVGUdoI84GiF6+cxpHoKmhEL3fgGqekcCEPfQXDFCd28XuykYf2GK RjtHdIVeyBn0k6NHtTOHHkETrBtByJRUz/QkvHi+bw5i4kiKSKQM41u41PXW5jNR54 H+t2OduLv2QrM952+Cqu23FNo77WIcWazosnwOcw= 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.18 529/957] backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt() Date: Wed, 20 May 2026 18:16:52 +0200 Message-ID: <20260520162146.005294015@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 2749231f03854..b2679b24de14b 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