diff mbox

: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}

Message ID 54E5CC26.8080800@gentoo.org
State Accepted
Headers show

Commit Message

Joshua Kinard Feb. 19, 2015, 11:42 a.m. UTC
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 mbox

Patch

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. */