All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: rs5c372: add missing error code for unknown RTC type
@ 2026-08-27  1:58 Liu Dalin
  2026-08-27  2:03 ` sashiko-bot
  2026-09-29 21:48 ` Alexandre Belloni
  0 siblings, 2 replies; 4+ messages in thread
From: Liu Dalin @ 2026-08-27  1:58 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Liu Dalin, Deng Yingchao, Qin Yungao,
	Luo Qiu

In rs5c372_probe(), when an unknown RTC type is encountered in the
switch default case, the local variable 'err' is still 0 from its
initialization. The subsequent goto to the exit label then returns
success, even though probe has failed.

Set err = -ENODEV before jumping to exit to properly report the
failure to the caller.

Fixes smatch warnings:
- drivers/rtc/rtc-rs5c372.c:860 rs5c372_probe() warn: missing error
  code 'err'

Fixes: cb26b572dc394 ("[PATCH] Update the rtc-rs5c372 driver")
Assisted-by: smatch:2.0 [static analysis]
Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn>
---
 drivers/rtc/rtc-rs5c372.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 24bd795d9d95..84407119caba 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -857,6 +857,7 @@ static int rs5c372_probe(struct i2c_client *client)
 		break;
 	default:
 		dev_err(&client->dev, "unknown RTC type\n");
+		err = -ENODEV;
 		goto exit;
 	}
 
-- 
2.43.0


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

end of thread, other threads:[~2026-09-30  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  1:58 [PATCH] rtc: rs5c372: add missing error code for unknown RTC type Liu Dalin
2026-08-27  2:03 ` sashiko-bot
2026-09-29 21:48 ` Alexandre Belloni
2026-09-30  1:07   ` liudalin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.