From patchwork Thu Feb 19 11:42:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Kinard X-Patchwork-Id: 441576 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-qa0-x239.google.com (mail-qa0-x239.google.com [IPv6:2607:f8b0:400d:c00::239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F17D14017C for ; Thu, 19 Feb 2015 22:42:48 +1100 (AEDT) Received: by mail-qa0-f57.google.com with SMTP id x12sf2237246qac.2 for ; Thu, 19 Feb 2015 03:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type: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; bh=SR7eMw61MDz9e20H8vbBIhNhibHK/gja3louqwPR5hI=; b=rVuRrib78vFJcFEUJ/NYAUKZnobQ7ncWZQcmf3BqJvC/Shf9pVTl+EO11Mtzei8jiO tUDDRgW2KnqKrKSVbPl6vibErIdmbklz4kqt8D8/4Kfpjjt2Z/5AA208C01W2kMQU62y s60tTIuKKSVJJVY4FmkVqR7NQ0S4UUuD/uprnfI9muX6fPFyMoB1VlqFopOdfVpmUDks D6/s60obhT5AIPDMAInf6Ns+u6GokY4KnN3Wqn5qBrfacPOYnvbzgyE0EoD8MOnQiG0m t6RDd+bjzIfoy5hoqAbsCkgdy9Ln5L4GsAL7zdqXyTUpbmMCVymQRfav6zJkK2Subc0V AdSg== X-Received: by 10.140.106.8 with SMTP id d8mr86459qgf.7.1424346166395; Thu, 19 Feb 2015 03:42:46 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.140.28.183 with SMTP id 52ls610452qgz.12.gmail; Thu, 19 Feb 2015 03:42:46 -0800 (PST) X-Received: by 10.236.207.230 with SMTP id n66mr3858838yho.30.1424346166194; Thu, 19 Feb 2015 03:42:46 -0800 (PST) Received: from resqmta-ch2-08v.sys.comcast.net (resqmta-ch2-08v.sys.comcast.net. [2001:558:fe21:29:69:252:207:40]) by gmr-mx.google.com with ESMTPS id kt5si5086044qcb.3.2015.02.19.03.42.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:42:46 -0800 (PST) Received-SPF: neutral (google.com: 2001:558:fe21:29:69:252:207:40 is neither permitted nor denied by domain of kumba@gentoo.org) client-ip=2001:558:fe21:29:69:252:207:40; Received: from resomta-ch2-14v.sys.comcast.net ([69.252.207.110]) by resqmta-ch2-08v.sys.comcast.net with comcast id uBiZ1p0032PT3Qt01Bil96; Thu, 19 Feb 2015 11:42:45 +0000 Received: from [192.168.1.13] ([69.250.160.75]) by resomta-ch2-14v.sys.comcast.net with comcast id uBik1p0071duFqV01BikfH; Thu, 19 Feb 2015 11:42:45 +0000 Message-ID: <54E5CC26.8080800@gentoo.org> Date: Thu, 19 Feb 2015 06:42:30 -0500 From: Joshua Kinard User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Andrew Morton , Alessandro Zummo CC: Dan Carpenter , Ralf Baechle , Linus Torvalds , rtc-linux@googlegroups.com, LKML Subject: [rtc-linux] [PATCH]: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show, store} X-Original-Sender: kumba@gentoo.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:558:fe21:29:69:252:207:40 is neither permitted nor denied by domain of kumba@gentoo.org) smtp.mail=kumba@gentoo.org; dkim=pass header.i=@comcast.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: , List-Unsubscribe: , From: Joshua Kinard Fix a conditional statement checking for NULL in both ds1685_rtc_sysfs_time_regs_show and ds1685_rtc_sysfs_time_regs_store that was using a logical AND when it should be using a logical OR so that we fail out of the function properly if the condition ever evaluates to true. Signed-off-by: Joshua Kinard Reported-by: Dan Carpenter Fixes: aaaf5fbf56f1: "rtc: add driver for DS1685 family of real time clocks" --- drivers/rtc/rtc-ds1685.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 29b461c..803869c 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c @@ -1610,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev, ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); /* Make sure we actually matched something. */ - if (!bcd_reg_info && !bin_reg_info) + if (!bcd_reg_info || !bin_reg_info) return -EINVAL; /* bcd_reg_info->reg == bin_reg_info->reg. */ @@ -1648,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev, return -EINVAL; /* Make sure we actually matched something. */ - if (!bcd_reg_info && !bin_reg_info) + if (!bcd_reg_info || !bin_reg_info) return -EINVAL; /* Check for a valid range. */