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 B0D22332EA7; Sat, 30 May 2026 17:19:50 +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=1780161591; cv=none; b=YqTSkl2rBu7XnCCmm+DvPTuCFcbHMLP2QlTHAyGziil3lgJVmqD7rB2vXtlrhrEsd10l0N6XnlGwmQ5GaCmHhsOdc7glMCIqvCd2EoRAMoJQUjAXI032HmSDPmt5/Lk08Qvo7g5nLdqVIHD7OWMWe9p3Xxw0yitAyrda8FpDWEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780161591; c=relaxed/simple; bh=z4bvkSlhmh0qr0fQfIWK7HfzvO8zed1eYEllZpVl1VY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QXtjpnb/GkG5I8swlrCgkqpap8usXC4jDhaUpuYceHtuGd59LToaxRctM5fM1+FNETfmOImVBTZNhoDuH7DlDPs0QujoF+QD1774uk+LRWb0dbxktprjdAOc1+6FJk+bq2vJhmIPv1fJhejFK9u7hHFc4rOnUHwJ1ZWPzLIssgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m234aQb/; 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="m234aQb/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDFD71F00893; Sat, 30 May 2026 17:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780161590; bh=u41oKRQBoOXOINhirMcfmRlPEtBs1rFOuNwKPGBnRKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m234aQb/C+HCd35Ry+qGGoShZIMHcq5bqfLrSOUGcFy6ZR5scoOuRX1/xZGxBeGKa pPcFYQsI8K0KW5weDYw0XsBMLRI731tRD+dCkxsN0LTm+erGYesVszJvq1gRyJBclM 2YyKA+SSWsmvUjnDWd9EVfKey7JHdKxI5uxtQOzg= 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.1 638/969] backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt() Date: Sat, 30 May 2026 18:02:42 +0200 Message-ID: <20260530160318.069781894@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@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.1-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 c95e0de7f4e70..0cf1f588a3873 100644 --- a/drivers/video/backlight/sky81452-backlight.c +++ b/drivers/video/backlight/sky81452-backlight.c @@ -204,6 +204,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