Re: [PATCH] leds: rgb: leds-ktd202x: Fix error code in ktd202x_setup_led_rgb()
From: Andy Shevchenko
Date: Tue Dec 09 2025 - 09:14:54 EST
On Tue, Dec 9, 2025 at 8:56 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> 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.
...
> 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;
> }
I think the better fix is to split the original conditional to two.
And make the message something like
"can't retrieve 'reg' property of %pfw\n'
for the case if (ret).
--
With Best Regards,
Andy Shevchenko