From: Joshua Kinard <kumba@gentoo.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Alessandro Zummo <a.zummo@towertech.it>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Ralf Baechle <ralf@linux-mips.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
rtc-linux@googlegroups.com, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH]: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
Date: Thu, 19 Feb 2015 06:42:30 -0500 [thread overview]
Message-ID: <54E5CC26.8080800@gentoo.org> (raw)
From: Joshua Kinard <kumba@gentoo.org>
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 <kumba@gentoo.org>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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. */
reply other threads:[~2015-02-19 11:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E5CC26.8080800@gentoo.org \
--to=kumba@gentoo.org \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=rtc-linux@googlegroups.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox