linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rtc: rx8010: Fix for incorrect return value
@ 2017-11-08 19:58 Akshay Bhat
  2017-11-09  0:18 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Akshay Bhat @ 2017-11-08 19:58 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Akshay Bhat

The err variable is not being reset after a successful read. Explicitly
return 0 at the end of function call to account for all return paths.

Reported-by: Jens-Peter Oswald <oswald@lre.de>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
---
v2: Address comments from Alexandre Belloni
- Return 0 at end of function instead of resetting err variable

 drivers/rtc/rtc-rx8010.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 2e06e5f..5c5938a 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -247,7 +247,7 @@ static int rx8010_init_client(struct i2c_client *client)
 
 	rx8010->ctrlreg = (ctrl[1] & ~RX8010_CTRL_TEST);
 
-	return err;
+	return 0;
 }
 
 static int rx8010_read_alarm(struct device *dev, struct rtc_wkalrm *t)
@@ -276,7 +276,7 @@ static int rx8010_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 	t->enabled = !!(rx8010->ctrlreg & RX8010_CTRL_AIE);
 	t->pending = (flagreg & RX8010_FLAG_AF) && t->enabled;
 
-	return err;
+	return 0;
 }
 
 static int rx8010_set_alarm(struct device *dev, struct rtc_wkalrm *t)
-- 
2.7.4

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

* Re: [PATCH v2] rtc: rx8010: Fix for incorrect return value
  2017-11-08 19:58 [PATCH v2] rtc: rx8010: Fix for incorrect return value Akshay Bhat
@ 2017-11-09  0:18 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2017-11-09  0:18 UTC (permalink / raw)
  To: Akshay Bhat; +Cc: a.zummo, linux-rtc, linux-kernel

On 08/11/2017 at 14:58:14 -0500, Akshay Bhat wrote:
> The err variable is not being reset after a successful read. Explicitly
> return 0 at the end of function call to account for all return paths.
> 
> Reported-by: Jens-Peter Oswald <oswald@lre.de>
> Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
> ---
> v2: Address comments from Alexandre Belloni
> - Return 0 at end of function instead of resetting err variable
> 
>  drivers/rtc/rtc-rx8010.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
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-11-09  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 19:58 [PATCH v2] rtc: rx8010: Fix for incorrect return value Akshay Bhat
2017-11-09  0:18 ` 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).