* [PATCH] rtc: rv3029: Revert my error handling patch to rv3029_eeprom_write()
@ 2019-08-17 6:56 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-08-17 6:56 UTC (permalink / raw)
To: Alessandro Zummo, Tom Evans; +Cc: Alexandre Belloni, linux-rtc, kernel-janitors
My error handling "cleanup" was totally wrong. Both the "err" and "ret"
variables are required. The "err" variable holds the error codes for
rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes
for if actual write fails. In my patch if the write failed, the
function probably still returned success.
Reported-by: Tom Evans <tom.evans@motec.com.au>
Fixes: 97f5b0379c38 ("rtc: rv3029: Clean up error handling in rv3029_eeprom_write()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/rtc/rtc-rv3029c2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 4a0e8ec015cc..4cdf6588e1d9 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -278,13 +278,13 @@ static int rv3029_eeprom_read(struct device *dev, u8 reg,
static int rv3029_eeprom_write(struct device *dev, u8 reg,
u8 const buf[], size_t len)
{
- int ret;
+ int ret, err;
size_t i;
u8 tmp;
- ret = rv3029_eeprom_enter(dev);
- if (ret < 0)
- return ret;
+ err = rv3029_eeprom_enter(dev);
+ if (err < 0)
+ return err;
for (i = 0; i < len; i++, reg++) {
ret = rv3029_read_regs(dev, reg, &tmp, 1);
@@ -300,11 +300,11 @@ static int rv3029_eeprom_write(struct device *dev, u8 reg,
break;
}
- ret = rv3029_eeprom_exit(dev);
- if (ret < 0)
- return ret;
+ err = rv3029_eeprom_exit(dev);
+ if (err < 0)
+ return err;
- return 0;
+ return ret;
}
static int rv3029_eeprom_update_bits(struct device *dev,
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] rtc: rv3029: Revert my error handling patch to rv3029_eeprom_write()
@ 2019-08-17 6:56 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-08-17 6:56 UTC (permalink / raw)
To: Alessandro Zummo, Tom Evans; +Cc: Alexandre Belloni, linux-rtc, kernel-janitors
My error handling "cleanup" was totally wrong. Both the "err" and "ret"
variables are required. The "err" variable holds the error codes for
rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes
for if actual write fails. In my patch if the write failed, the
function probably still returned success.
Reported-by: Tom Evans <tom.evans@motec.com.au>
Fixes: 97f5b0379c38 ("rtc: rv3029: Clean up error handling in rv3029_eeprom_write()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/rtc/rtc-rv3029c2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 4a0e8ec015cc..4cdf6588e1d9 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -278,13 +278,13 @@ static int rv3029_eeprom_read(struct device *dev, u8 reg,
static int rv3029_eeprom_write(struct device *dev, u8 reg,
u8 const buf[], size_t len)
{
- int ret;
+ int ret, err;
size_t i;
u8 tmp;
- ret = rv3029_eeprom_enter(dev);
- if (ret < 0)
- return ret;
+ err = rv3029_eeprom_enter(dev);
+ if (err < 0)
+ return err;
for (i = 0; i < len; i++, reg++) {
ret = rv3029_read_regs(dev, reg, &tmp, 1);
@@ -300,11 +300,11 @@ static int rv3029_eeprom_write(struct device *dev, u8 reg,
break;
}
- ret = rv3029_eeprom_exit(dev);
- if (ret < 0)
- return ret;
+ err = rv3029_eeprom_exit(dev);
+ if (err < 0)
+ return err;
- return 0;
+ return ret;
}
static int rv3029_eeprom_update_bits(struct device *dev,
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: rv3029: Revert my error handling patch to rv3029_eeprom_write()
2019-08-17 6:56 ` Dan Carpenter
@ 2019-08-20 19:47 ` Alexandre Belloni
-1 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2019-08-20 19:47 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Alessandro Zummo, Tom Evans, linux-rtc, kernel-janitors
On 17/08/2019 09:56:04+0300, Dan Carpenter wrote:
> My error handling "cleanup" was totally wrong. Both the "err" and "ret"
> variables are required. The "err" variable holds the error codes for
> rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes
> for if actual write fails. In my patch if the write failed, the
> function probably still returned success.
>
> Reported-by: Tom Evans <tom.evans@motec.com.au>
> Fixes: 97f5b0379c38 ("rtc: rv3029: Clean up error handling in rv3029_eeprom_write()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/rtc/rtc-rv3029c2.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: rv3029: Revert my error handling patch to rv3029_eeprom_write()
@ 2019-08-20 19:47 ` Alexandre Belloni
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2019-08-20 19:47 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Alessandro Zummo, Tom Evans, linux-rtc, kernel-janitors
On 17/08/2019 09:56:04+0300, Dan Carpenter wrote:
> My error handling "cleanup" was totally wrong. Both the "err" and "ret"
> variables are required. The "err" variable holds the error codes for
> rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes
> for if actual write fails. In my patch if the write failed, the
> function probably still returned success.
>
> Reported-by: Tom Evans <tom.evans@motec.com.au>
> Fixes: 97f5b0379c38 ("rtc: rv3029: Clean up error handling in rv3029_eeprom_write()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/rtc/rtc-rv3029c2.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-20 19:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-17 6:56 [PATCH] rtc: rv3029: Revert my error handling patch to rv3029_eeprom_write() Dan Carpenter
2019-08-17 6:56 ` Dan Carpenter
2019-08-20 19:47 ` Alexandre Belloni
2019-08-20 19:47 ` Alexandre Belloni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.