[<prev] [next>] [day] [month] [year] [list]
Message-ID: <54E5CC26.8080800@gentoo.org>
Date: Thu, 19 Feb 2015 06:42:30 -0500
From: Joshua Kinard <kumba@...too.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Alessandro Zummo <a.zummo@...ertech.it>
CC: Dan Carpenter <dan.carpenter@...cle.com>,
Ralf Baechle <ralf@...ux-mips.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
rtc-linux@...glegroups.com, LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH]: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
From: Joshua Kinard <kumba@...too.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@...too.org>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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. */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists