[bug report] rtc: Introduce ti-k3-rtc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux