linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: rv3029: Clean up error handling in rv3029_eeprom_write()
@ 2017-09-20 21:45 Dan Carpenter
  2017-10-12 14:40 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-09-20 21:45 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: Alexandre Belloni, linux-rtc, kernel-janitors

We don't need both "ret" and "err" when they do the same thing.  All the
functions called here return zero on success or negative error codes.
It's more clear to return a literal zero at the end instead of
"return ret;"

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index aa09771de04f..f4f957ab5fe6 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -282,13 +282,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, err;
+	int ret;
 	size_t i;
 	u8 tmp;
 
-	err = rv3029_eeprom_enter(dev);
-	if (err < 0)
-		return err;
+	ret = rv3029_eeprom_enter(dev);
+	if (ret < 0)
+		return ret;
 
 	for (i = 0; i < len; i++, reg++) {
 		ret = rv3029_read_regs(dev, reg, &tmp, 1);
@@ -304,11 +304,11 @@ static int rv3029_eeprom_write(struct device *dev, u8 reg,
 			break;
 	}
 
-	err = rv3029_eeprom_exit(dev);
-	if (err < 0)
-		return err;
+	ret = rv3029_eeprom_exit(dev);
+	if (ret < 0)
+		return ret;
 
-	return ret;
+	return 0;
 }
 
 static int rv3029_eeprom_update_bits(struct device *dev,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: rv3029: Clean up error handling in rv3029_eeprom_write()
  2017-09-20 21:45 [PATCH] rtc: rv3029: Clean up error handling in rv3029_eeprom_write() Dan Carpenter
@ 2017-10-12 14:40 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2017-10-12 14:40 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alessandro Zummo, linux-rtc, kernel-janitors

On 21/09/2017 at 00:45:30 +0300, Dan Carpenter wrote:
> We don't need both "ret" and "err" when they do the same thing.  All the
> functions called here return zero on success or negative error codes.
> It's more clear to return a literal zero at the end instead of
> "return ret;"
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-12 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 21:45 [PATCH] rtc: rv3029: Clean up error handling in rv3029_eeprom_write() Dan Carpenter
2017-10-12 14:40 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).