: rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
PATCH 1/1 : rtc: ds1685: Fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
From: Joshua Kinard <[email protected]>
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 <[email protected]>
Reported-by Dan Carpenter <[email protected]>
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(-)
drivers/rtc/rtc-ds1685.c +2 -2
@@ -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. */