aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJoshua Kinard <kumba@gentoo.org>2015-02-27 18:51:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-28 12:57:51 -0500
commitb00eeaedece2e8cb1607cb015f10e572e2607c49 (patch)
tree1e3a18d522dbcf31ac7119e882ed39bee96ba402 /drivers/rtc
parent957ed60b53b519064a54988c4e31e0087e47d091 (diff)
drivers/rtc/rtc-ds1685.c: fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
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. Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks") Signed-off-by: Joshua Kinard <kumba@gentoo.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds1685.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 29b461c76072..803869c7d7c2 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,
1610 ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); 1610 ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false);
1611 1611
1612 /* Make sure we actually matched something. */ 1612 /* Make sure we actually matched something. */
1613 if (!bcd_reg_info && !bin_reg_info) 1613 if (!bcd_reg_info || !bin_reg_info)
1614 return -EINVAL; 1614 return -EINVAL;
1615 1615
1616 /* bcd_reg_info->reg == bin_reg_info->reg. */ 1616 /* bcd_reg_info->reg == bin_reg_info->reg. */
@@ -1648,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev,
1648 return -EINVAL; 1648 return -EINVAL;
1649 1649
1650 /* Make sure we actually matched something. */ 1650 /* Make sure we actually matched something. */
1651 if (!bcd_reg_info && !bin_reg_info) 1651 if (!bcd_reg_info || !bin_reg_info)
1652 return -EINVAL; 1652 return -EINVAL;
1653 1653
1654 /* Check for a valid range. */ 1654 /* Check for a valid range. */