I've changed the comparison:
@@ -525,7 +525,7 @@  static int stm32_rtc_init(struct platform_device *pdev,
                pred_s = (rate / (pred_a + 1)) - 1;

                dev_warn(&pdev->dev, "ck_rtc is %s\n",
-                        (rate - ((pred_a + 1) * (pred_s + 1)) < 0) ?
+                        (rate < ((pred_a + 1) * (pred_s + 1))) ?
                         "fast" : "slow");
        }
Now, rate (unsigned) is compared to ((pred_a + 1) * (pred_s + 1)) (unsigned), so no further "unsigned expression < 0 is always false".

Regards,
Amelie
On 01/16/2017 01:21 PM, Dan Carpenter wrote:
Oh.  That still won't fix this:

drivers/rtc/rtc-stm32.c
   519          /*
   520           * Can't find a 1Hz, so give priority to RTC power consumption
   521           * by choosing the higher possible value for prediv_a
   522           */
   523          if ((pred_s > pred_s_max) || (pred_a > pred_a_max)) {
   524                  pred_a = pred_a_max;
   525                  pred_s = (rate / (pred_a + 1)) - 1;
   526
   527                  dev_warn(&pdev->dev, "ck_rtc is %s\n",
   528                           (rate - ((pred_a + 1) * (pred_s + 1)) < 0) ?

This is type promoted to unsigned int < 0.

   529                           "fast" : "slow");
   530          }

regards,
dan carpenter


--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to