From patchwork Thu Oct 28 14:07:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 69465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ww0-f56.google.com (mail-ww0-f56.google.com [74.125.82.56]) by ozlabs.org (Postfix) with ESMTP id 53950B6F11 for ; Fri, 29 Oct 2010 01:07:29 +1100 (EST) Received: by wwj40 with SMTP id 40sf1023891wwj.11 for ; Thu, 28 Oct 2010 07:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:in-reply-to:user-agent :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type :content-disposition; bh=OfE6iE1IJxoxd0WQ9iXVSzyMyaKUcw4h3z01RyET67M=; b=QXUIy8Fv+TrgkadWZg2bLQ/5N9D4Cvr+hZOWImo+AysYWHlgX9tWv+gFJBpAQ/yIzA 3J7jn4lytydP6usESIjENgRXndqovnc5FoL5A0QI1+8jYZWlBpttYw48SjRVjqn4nt8g lIxsn+eoZ3pg7BlmSNFElRBuzVia15cyx4OcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type:content-disposition; b=lzjzsltmeugFc45TH5spa8Vbrq7ZoSbBgnUPeRyT60cGbS1r8WAbN4yor2ejhuFWYT saOqSt8FH99/5VPgoUSwIKWDF4FLtk1z5jf4kxUkjSXrCg5h1stdMxk36imtE2F/vGBK ofZ3axsRZspBgmXHa7IK0H006dbCPjDj77ZKA= Received: by 10.216.72.142 with SMTP id t14mr25626wed.18.1288274846427; Thu, 28 Oct 2010 07:07:26 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.216.5.203 with SMTP id 53ls727445wel.3.p; Thu, 28 Oct 2010 07:07:24 -0700 (PDT) Received: by 10.216.46.14 with SMTP id q14mr15339web.13.1288274844483; Thu, 28 Oct 2010 07:07:24 -0700 (PDT) Received: by 10.216.46.14 with SMTP id q14mr15338web.13.1288274844450; Thu, 28 Oct 2010 07:07:24 -0700 (PDT) Received: from mail-wy0-f177.google.com (mail-wy0-f177.google.com [74.125.82.177]) by gmr-mx.google.com with ESMTP id t18si311454wes.1.2010.10.28.07.07.23; Thu, 28 Oct 2010 07:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of error27@gmail.com designates 74.125.82.177 as permitted sender) client-ip=74.125.82.177; Received: by mail-wy0-f177.google.com with SMTP id 22so1867874wyf.8 for ; Thu, 28 Oct 2010 07:07:23 -0700 (PDT) Received: by 10.216.153.140 with SMTP id f12mr228660wek.111.1288274843252; Thu, 28 Oct 2010 07:07:23 -0700 (PDT) Received: from bicker (h2dcc.n1.ips.mtn.co.ug [41.210.173.204]) by mx.google.com with ESMTPS id x15sm732347weq.31.2010.10.28.07.07.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 28 Oct 2010 07:07:22 -0700 (PDT) Date: Thu, 28 Oct 2010 16:07:13 +0200 From: Dan Carpenter To: Lan Chunhe-B25806 Cc: tie-fei.zang@freescale.com, rtc-linux@googlegroups.com, kernel-janitors@vger.kernel.org, Alessandro Zummo Subject: [rtc-linux] [patch] rtc: ds3232: remove unneeded check Message-ID: <20101028140713.GF6062@bicker> References: <20101028083503.GZ6062@bicker> <20101028085522.GA6062@bicker> <20101028105840.GB6062@bicker> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Original-Sender: error27@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of error27@gmail.com designates 74.125.82.177 as permitted sender) smtp.mail=error27@gmail.com; dkim=pass (test mode) header.i=@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Disposition: inline bcd2bin() returns unsigned values so they're never less than zero. I asked Jack Lan and he said I could just remove that part of the check. Signed-off-by: Dan Carpenter Acked-by: Roy Zang diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 5706355..7767b4f 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c @@ -289,14 +289,10 @@ static void ds3232_update_alarm(struct i2c_client *client) if (ret < 0) goto unlock; - buf[0] = bcd2bin(buf[0]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ? - 0x80 : buf[0]; - buf[1] = bcd2bin(buf[1]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ? - 0x80 : buf[1]; - buf[2] = bcd2bin(buf[2]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ? - 0x80 : buf[2]; - buf[3] = bcd2bin(buf[3]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ? - 0x80 : buf[3]; + buf[0] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[0]; + buf[1] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[1]; + buf[2] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[2]; + buf[3] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[3]; ret = i2c_smbus_write_i2c_block_data(client, DS3232_REG_ALARM1, 4, buf); if (ret < 0)