mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
leds: max77705: Function return instead of variable assignment
Coverity noticed that assigning value -EINVAL to 'ret' in the if
statement is useless because 'ret' is overwritten a few lines later.
However, after inspect the code, this warning reveals that we need to
return -EINVAL instead of the variable assignment. So, fix it.
Coverity-id: 1646104
Fixes: aebb5fc9a0 ("leds: max77705: Add LEDs support")
Signed-off-by: Len Bao <len.bao@gmx.us>
Link: https://lore.kernel.org/r/20250727075649.34496-1-len.bao@gmx.us
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
@@ -180,7 +180,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw
|
||||
|
||||
ret = fwnode_property_read_u32(np, "reg", ®);
|
||||
if (ret || reg >= MAX77705_LED_NUM_LEDS)
|
||||
ret = -EINVAL;
|
||||
return -EINVAL;
|
||||
|
||||
info = devm_kcalloc(dev, num_channels, sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
|
||||
Reference in New Issue
Block a user