Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: aebb5fc9a0d8 ("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>

authored by

Len Bao and committed by
Lee Jones
6e3779e3 f4fc2d87

+1 -1
+1 -1
drivers/leds/leds-max77705.c
··· 180 180 181 181 ret = fwnode_property_read_u32(np, "reg", &reg); 182 182 if (ret || reg >= MAX77705_LED_NUM_LEDS) 183 - ret = -EINVAL; 183 + return -EINVAL; 184 184 185 185 info = devm_kcalloc(dev, num_channels, sizeof(*info), GFP_KERNEL); 186 186 if (!info)