mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Liu Dalin <liudalin@kylinsec.com.cn>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Deng Yingchao <dengyingchao@kylinsec.com.cn>,
	Qin Yungao <qinyungao@kylinsec.com.cn>,
	Luo Qiu <luoqiu@kylinsec.com.cn>
Subject: Re: [PATCH] rtc: rs5c372: add missing error code for unknown RTC type
Date: Tue, 29 Sep 2026 23:48:17 +0200	[thread overview]
Message-ID: <2026092921481727857dc7@mail.local> (raw)
In-Reply-To: <C18300C5767FC690+20260827015846.3314353-1-liudalin@kylinsec.com.cn>

On 27/08/2026 09:58:46+0800, Liu Dalin wrote:
> 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;

But isn't this dead code that will never be reached? In what case would
you be probed and not match any i2c_device_id?

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2026-09-29 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  1:58 Liu Dalin
2026-09-29 21:48 ` Alexandre Belloni [this message]
2026-09-30  1:07   ` liudalin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026092921481727857dc7@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=dengyingchao@kylinsec.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=liudalin@kylinsec.com.cn \
    --cc=luoqiu@kylinsec.com.cn \
    --cc=qinyungao@kylinsec.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®