[v2,1/2] rtc: hym8563: Return -EINVAL if the time is known to be invalid
diff mbox series

Message ID 20191212153111.966923-1-paul.kocialkowski@bootlin.com
State Accepted
Headers show
Series
  • [v2,1/2] rtc: hym8563: Return -EINVAL if the time is known to be invalid
Related show

Commit Message

Paul Kocialkowski Dec. 12, 2019, 3:31 p.m. UTC
The current code returns -EPERM when the voltage loss bit is set.
Since the bit indicates that the time value is not valid, return
-EINVAL instead, which is the appropriate error code for this
situation.

Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
Changes since v1:
- Addded Fixes tag.

 drivers/rtc/rtc-hym8563.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Belloni Dec. 23, 2019, 10:18 a.m. UTC | #1
On 12/12/2019 16:31:10+0100, Paul Kocialkowski wrote:
> The current code returns -EPERM when the voltage loss bit is set.
> Since the bit indicates that the time value is not valid, return
> -EINVAL instead, which is the appropriate error code for this
> situation.
> 
> Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> ---
> Changes since v1:
> - Addded Fixes tag.
> 
>  drivers/rtc/rtc-hym8563.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.

Patch
diff mbox series

diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index 443f6d05ce29..fb6d7967ec00 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -97,7 +97,7 @@  static int hym8563_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 	if (!hym8563->valid) {
 		dev_warn(&client->dev, "no valid clock/calendar values available\n");
-		return -EPERM;
+		return -EINVAL;
 	}
 
 	ret = i2c_smbus_read_i2c_block_data(client, HYM8563_SEC, 7, buf);