From patchwork Sat Jun 25 21:05:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 102043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-fx0-f56.google.com (mail-fx0-f56.google.com [209.85.161.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 142CBB6F84 for ; Sun, 26 Jun 2011 07:14:17 +1000 (EST) Received: by fxg17 with SMTP id 17sf1202071fxg.11 for ; Sat, 25 Jun 2011 14:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:x-beenthere:received-spf:date:from:to:cc :subject:message-id:user-agent:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=Yhux/4/7qPCBWv6DQGCiJbWHHWVYdfEi8xwRbu/NROo=; b=gKkGDNxTJ0gcRBfGMC6xbHRuPnTOQZ2xB/0xL0hALkatuoydjVULqh2mq7/FEttSU5 IoPHMMp4EmnyS+pR4iyl+1Sg0SRJWlURflzTFilwd4MIbuA3s0m8+rjzA5yohsYupckc VEwhWon90JwtOI6GjLDHEuPICAl26bsw50tEI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:date:from:to:cc:subject:message-id :user-agent:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; b=Sp6NicGyjK5jUjXAKbE9iAec/rn5aH9a7LndEaeezcxK4+gLz14GG/6q93a3dIL23T XsFnAdRuWccEb5Ti9edMtJnXYEbExp1tVea8q6UBB15xXwkBAXZmpUAO4M39jxjTu/VA iZaTZhCBuq09B6VTD3+ax4EARWMGYBbIrvyo8= Received: by 10.223.81.195 with SMTP id y3mr919143fak.43.1309036451777; Sat, 25 Jun 2011 14:14:11 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.204.166.66 with SMTP id l2ls2010393bky.2.gmail; Sat, 25 Jun 2011 14:14:10 -0700 (PDT) Received: by 10.204.85.21 with SMTP id m21mr407346bkl.22.1309036450654; Sat, 25 Jun 2011 14:14:10 -0700 (PDT) Received: by 10.204.85.21 with SMTP id m21mr407345bkl.22.1309036450633; Sat, 25 Jun 2011 14:14:10 -0700 (PDT) Received: from swampdragon.chaosbits.net (swampdragon.chaosbits.net [90.184.90.115]) by gmr-mx.google.com with ESMTP id y18si1861775bkf.2.2011.06.25.14.14.09; Sat, 25 Jun 2011 14:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of jj@chaosbits.net designates 90.184.90.115 as permitted sender) client-ip=90.184.90.115; Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 2699794051; Sat, 25 Jun 2011 23:05:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 150579403E; Sat, 25 Jun 2011 23:05:10 +0200 (CEST) Date: Sat, 25 Jun 2011 23:05:09 +0200 (CEST) From: Jesper Juhl To: rtc-linux@googlegroups.com cc: Alessandro Zummo , linux-kernel@vger.kernel.org, Alexandre Rusev , "George G. Davis" , source@mvista.com Subject: [rtc-linux] [PATCH] rtc: Check return value of twl_rtc_write_u8() in twl_rtc_set_time() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 X-Original-Sender: jj@chaosbits.net X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jj@chaosbits.net designates 90.184.90.115 as permitted sender) smtp.mail=jj@chaosbits.net Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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;