mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-06 14:45:14 +00:00
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: aaaf5fbf56
("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>
This commit is contained in:
parent
957ed60b53
commit
b00eeaedec
1 changed files with 2 additions and 2 deletions
|
@ -1610,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev,
|
||||||
ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false);
|
ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false);
|
||||||
|
|
||||||
/* Make sure we actually matched something. */
|
/* Make sure we actually matched something. */
|
||||||
if (!bcd_reg_info && !bin_reg_info)
|
if (!bcd_reg_info || !bin_reg_info)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* bcd_reg_info->reg == bin_reg_info->reg. */
|
/* bcd_reg_info->reg == bin_reg_info->reg. */
|
||||||
|
@ -1648,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Make sure we actually matched something. */
|
/* Make sure we actually matched something. */
|
||||||
if (!bcd_reg_info && !bin_reg_info)
|
if (!bcd_reg_info || !bin_reg_info)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Check for a valid range. */
|
/* Check for a valid range. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue