From: Dan Carpenter <dan.carpenter@linaro.org>
To: Kate Hsuan <hpa@redhat.com>
Cc: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Hans de Goede <hansg@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] leds: rgb: leds-ktd202x: Fix error code in ktd202x_setup_led_rgb()
Date: Tue, 9 Dec 2025 09:56:28 +0300 [thread overview]
Message-ID: <aTfIHE_2-iKIrwqv@stanley.mountain> (raw)
Return -EINVAL if the "reg" value is invalid. This is unlikely to
happen in real life because it comes from the firmware, whether from
device tree or ACPI.
Fixes: f14aa5ea415b ("leds: rgb: leds-ktd202x: Get device properties through fwnode to support ACPI")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/leds/rgb/leds-ktd202x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/rgb/leds-ktd202x.c b/drivers/leds/rgb/leds-ktd202x.c
index e4f0f25a5e45..3b7f2272036c 100644
--- a/drivers/leds/rgb/leds-ktd202x.c
+++ b/drivers/leds/rgb/leds-ktd202x.c
@@ -410,7 +410,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwn
if (ret != 0 || reg >= chip->num_leds) {
dev_err(chip->dev, "invalid 'reg' of %pfw\n", child);
fwnode_handle_put(child);
- return ret;
+ return ret ?: -EINVAL;
}
ret = fwnode_property_read_u32(child, "color", &mono_color);
--
2.51.0
next reply other threads:[~2025-12-09 6:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 6:56 Dan Carpenter [this message]
2025-12-09 14:14 ` [PATCH] leds: rgb: leds-ktd202x: Fix error code in ktd202x_setup_led_rgb() Andy Shevchenko
2025-12-09 14:41 ` Dan Carpenter
2025-12-09 14:44 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aTfIHE_2-iKIrwqv@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=andy@kernel.org \
--cc=hansg@kernel.org \
--cc=hpa@redhat.com \
--cc=jonathan.cameron@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox