RE: [PATCH] rtc: mxc_v2: unlock on error in mxc_rtc_set_alarm()

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

 



>From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
>Sent: Mittwoch, 14. März 2018 08:37
>
>We need to unlock if time is more than U32_MAX.
>
you are right, that's a bug.
But I would move the mxc_rtc_lock() entirely behind the (time > U32_MAX) check. IMHO that would make the code even cleaner. sorry for broken patch:

>       const time64_t time = rtc_tm_to_time64(&alrm->time);
>       struct mxc_rtc_data *pdata = dev_get_drvdata(dev);
>-      int ret = mxc_rtc_lock(pdata);
>+      int ret;
>-
>-      if (ret)
>-              return ret;
>
>       if (time > U32_MAX) {
>               dev_err(dev, "Hopefully I am out of service by then :-(\n");
>               return -EINVAL;
>       }
>+
>+      ret = mxc_rtc_lock(pdata);
>+      if (ret)
>+              return ret;

---
Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075



--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux