From patchwork Sat Jun 25 21:05:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: rtc: Check return value of twl_rtc_write_u8() in twl_rtc_set_time() Date: Sat, 25 Jun 2011 11:05:09 -0000 From: Jesper Juhl X-Patchwork-Id: 102043 Message-Id: To: rtc-linux@googlegroups.com Cc: Alessandro Zummo , linux-kernel@vger.kernel.org, Alexandre Rusev , "George G. Davis" , source@mvista.com In drivers/rtc/rtc-twl.c:twl_rtc_set_time() we forget to save the return value of the call to twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); in 'ret', making the test of 'ret < 0' dead code since 'ret' then couldn't possibly have changed since the last test just a few lines above. It also makes us not detect failures from that specific twl_rtc_write_u8() call. Signed-off-by: Jesper Juhl --- drivers/rtc/rtc-twl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index f9a2799..9a81f77 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -275,7 +275,7 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm) goto out; save_control &= ~BIT_RTC_CTRL_REG_STOP_RTC_M; - twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); + ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); if (ret < 0) goto out;