linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: max77705: Function return instead of variable assignment
@ 2025-07-27  7:56 Len Bao
  2025-07-31 11:46 ` (subset) " Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Len Bao @ 2025-07-27  7:56 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones, Pavel Machek
  Cc: linux-kernel, linux-leds, Len Bao

Coverity noticed that assigning value -EINVAL to 'ret' in the if
statement is useless because 'ret' is overwritten a few lines later.
However, afer inspect the code, this warning reveals that we need to
return -EIVANL 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>
---
 drivers/leds/leds-max77705.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-max77705.c b/drivers/leds/leds-max77705.c
index 933cb4f19..b7403b3fc 100644
--- a/drivers/leds/leds-max77705.c
+++ b/drivers/leds/leds-max77705.c
@@ -180,7 +180,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw
 
 		ret = fwnode_property_read_u32(np, "reg", &reg);
 		if (ret || reg >= MAX77705_LED_NUM_LEDS)
-			ret = -EINVAL;
+			return -EINVAL;
 
 		info = devm_kcalloc(dev, num_channels, sizeof(*info), GFP_KERNEL);
 		if (!info)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: (subset) [PATCH] leds: max77705: Function return instead of variable assignment
  2025-07-27  7:56 [PATCH] leds: max77705: Function return instead of variable assignment Len Bao
@ 2025-07-31 11:46 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2025-07-31 11:46 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones, Pavel Machek,
	Len Bao
  Cc: linux-kernel, linux-leds

On Sun, 27 Jul 2025 07:56:45 +0000, Len Bao wrote:
> Coverity noticed that assigning value -EINVAL to 'ret' in the if
> statement is useless because 'ret' is overwritten a few lines later.
> However, afer inspect the code, this warning reveals that we need to
> return -EIVANL instead of the variable assignment. So, fix it.
> 
> 

Applied, thanks!

[1/1] leds: max77705: Function return instead of variable assignment
      commit: 5913b60c2851102d51469ae7a2a69344a3a83eaf

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-31 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-27  7:56 [PATCH] leds: max77705: Function return instead of variable assignment Len Bao
2025-07-31 11:46 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).