* [PATCH]: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
@ 2015-02-19 11:42 Joshua Kinard
0 siblings, 0 replies; only message in thread
From: Joshua Kinard @ 2015-02-19 11:42 UTC (permalink / raw)
To: Andrew Morton, Alessandro Zummo
Cc: Dan Carpenter, Ralf Baechle, Linus Torvalds, rtc-linux, LKML
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. */
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-19 11:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 11:42 [PATCH]: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store} Joshua Kinard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox