public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: nm@ti.com
Cc: linux-rtc@vger.kernel.org
Subject: [bug report] rtc: Introduce ti-k3-rtc
Date: Tue, 28 Jun 2022 09:56:29 +0300	[thread overview]
Message-ID: <YrqmHSiHfLJegA4v@kili> (raw)

Hello Nishanth Menon,

The patch b09d633575e5: "rtc: Introduce ti-k3-rtc" from Jun 23, 2022,
leads to the following Smatch static checker warning:

	drivers/rtc/rtc-ti-k3.c:186 k3rtc_unlock_rtc()
	info: return a literal instead of 'ret'

drivers/rtc/rtc-ti-k3.c
    180 static int k3rtc_unlock_rtc(struct ti_k3_rtc *priv)
    181 {
    182         int ret;
    183 
    184         ret = k3rtc_check_unlocked(priv);
    185         if (!ret)
--> 186                 return ret;

It look more intentional when code uses literals:

	if (!ret)
		return 0;

The k3rtc_check_unlocked() function can also return error codes so maybe
this should be:

	if (ret <= 0)
		return 0;

    187 
    188         k3rtc_field_write(priv, K3RTC_KICK0, K3RTC_KICK0_UNLOCK_VALUE);
    189         k3rtc_field_write(priv, K3RTC_KICK1, K3RTC_KICK1_UNLOCK_VALUE);
    190 
    191         /* Skip fence since we are going to check the unlock bit as fence */
    192         ret = regmap_field_read_poll_timeout(priv->r_fields[K3RTC_UNLOCK], ret,
    193                                              !ret, 2, priv->sync_timeout_us);
    194 
    195         return ret;
    196 }

regards,
dan carpenter

             reply	other threads:[~2022-06-28  6:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28  6:56 Dan Carpenter [this message]
2022-07-01  1:48 ` [bug report] rtc: Introduce ti-k3-rtc Nishanth Menon
2022-07-01  4:43   ` Dan Carpenter

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=YrqmHSiHfLJegA4v@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=nm@ti.com \
    /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