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.
Unified · Split
| @@ -1610,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev, · 1609 unmodified lines | ||
| 1610 | 1610 | ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); |
| 1611 | 1611 | |
| 1612 | 1612 | /* Make sure we actually matched something. */ |
| 1613 | − if (!bcd_reg_info && !bin_reg_info) | |
| 1613 | + if (!bcd_reg_info || !bin_reg_info) | |
| 1614 | 1614 | return -EINVAL; |
| 1615 | 1615 | |
| 1616 | 1616 | /* bcd_reg_info->reg == bin_reg_info->reg. */ |
| @@ -1648,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev, · 31 unmodified lines | ||
| 1648 | 1648 | return -EINVAL; |
| 1649 | 1649 | |
| 1650 | 1650 | /* Make sure we actually matched something. */ |
| 1651 | − if (!bcd_reg_info && !bin_reg_info) | |
| 1651 | + if (!bcd_reg_info || !bin_reg_info) | |
| 1652 | 1652 | return -EINVAL; |
| 1653 | 1653 | |
| 1654 | 1654 | /* Check for a valid range. */ |