linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] rtc: rx8010: Remove duplicate define
@ 2017-11-03 17:32 Akshay Bhat
  2017-11-03 17:32 ` [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31 Akshay Bhat
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Akshay Bhat @ 2017-11-03 17:32 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Akshay Bhat

Remove duplicate define for RX8010_YEAR

Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
---
 drivers/rtc/rtc-rx8010.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 1ed3403..f948f75 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -24,7 +24,6 @@
 #define RX8010_MDAY    0x14
 #define RX8010_MONTH   0x15
 #define RX8010_YEAR    0x16
-#define RX8010_YEAR    0x16
 #define RX8010_RESV17  0x17
 #define RX8010_ALMIN   0x18
 #define RX8010_ALHOUR  0x19
-- 
2.7.4

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

* [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31
  2017-11-03 17:32 [PATCH 1/3] rtc: rx8010: Remove duplicate define Akshay Bhat
@ 2017-11-03 17:32 ` Akshay Bhat
  2017-11-08  2:28   ` Alexandre Belloni
  2017-11-03 17:32 ` [PATCH 3/3] rtc: rx8010: Fix for incorrect return value Akshay Bhat
  2017-11-08  2:28 ` [PATCH 1/3] rtc: rx8010: Remove duplicate define Alexandre Belloni
  2 siblings, 1 reply; 7+ messages in thread
From: Akshay Bhat @ 2017-11-03 17:32 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Akshay Bhat

Define for reserved register 31 had the incorrect address. Specify
the correct address.

Reported-by: Jens-Peter Oswald <oswald@lre.de>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
---
 drivers/rtc/rtc-rx8010.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index f948f75..2e06e5f 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -35,7 +35,7 @@
 #define RX8010_CTRL    0x1F
 /* 0x20 to 0x2F are user registers */
 #define RX8010_RESV30  0x30
-#define RX8010_RESV31  0x32
+#define RX8010_RESV31  0x31
 #define RX8010_IRQ     0x32
 
 #define RX8010_EXT_WADA  BIT(3)
-- 
2.7.4

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

* [PATCH 3/3] rtc: rx8010: Fix for incorrect return value
  2017-11-03 17:32 [PATCH 1/3] rtc: rx8010: Remove duplicate define Akshay Bhat
  2017-11-03 17:32 ` [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31 Akshay Bhat
@ 2017-11-03 17:32 ` Akshay Bhat
  2017-11-08  2:30   ` Alexandre Belloni
  2017-11-08  2:28 ` [PATCH 1/3] rtc: rx8010: Remove duplicate define Alexandre Belloni
  2 siblings, 1 reply; 7+ messages in thread
From: Akshay Bhat @ 2017-11-03 17:32 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
reset err variable to account for all return paths.

Reported-by: Jens-Peter Oswald <oswald@lre.de>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
---
 drivers/rtc/rtc-rx8010.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 2e06e5f..1ce2078 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -223,6 +223,7 @@ static int rx8010_init_client(struct i2c_client *client)
 					    2, ctrl);
 	if (err != 2)
 		return err < 0 ? err : -EIO;
+	err = 0;
 
 	if (ctrl[0] & RX8010_FLAG_VLF)
 		dev_warn(&client->dev, "Frequency stop was detected\n");
@@ -261,6 +262,7 @@ static int rx8010_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 	err = i2c_smbus_read_i2c_block_data(client, RX8010_ALMIN, 3, alarmvals);
 	if (err != 3)
 		return err < 0 ? err : -EIO;
+	err = 0;
 
 	flagreg = i2c_smbus_read_byte_data(client, RX8010_FLAG);
 	if (flagreg < 0)
-- 
2.7.4

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

* Re: [PATCH 1/3] rtc: rx8010: Remove duplicate define
  2017-11-03 17:32 [PATCH 1/3] rtc: rx8010: Remove duplicate define Akshay Bhat
  2017-11-03 17:32 ` [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31 Akshay Bhat
  2017-11-03 17:32 ` [PATCH 3/3] rtc: rx8010: Fix for incorrect return value Akshay Bhat
@ 2017-11-08  2:28 ` Alexandre Belloni
  2 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2017-11-08  2:28 UTC (permalink / raw)
  To: Akshay Bhat; +Cc: a.zummo, linux-rtc, linux-kernel

On 03/11/2017 at 13:32:39 -0400, Akshay Bhat wrote:
> Remove duplicate define for RX8010_YEAR
> 
> Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
> ---
>  drivers/rtc/rtc-rx8010.c | 1 -
>  1 file changed, 1 deletion(-)
> 
Applied, thanks.

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

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

* Re: [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31
  2017-11-03 17:32 ` [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31 Akshay Bhat
@ 2017-11-08  2:28   ` Alexandre Belloni
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2017-11-08  2:28 UTC (permalink / raw)
  To: Akshay Bhat; +Cc: a.zummo, linux-rtc, linux-kernel

On 03/11/2017 at 13:32:40 -0400, Akshay Bhat wrote:
> Define for reserved register 31 had the incorrect address. Specify
> the correct address.
> 
> Reported-by: Jens-Peter Oswald <oswald@lre.de>
> Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
> ---
>  drivers/rtc/rtc-rx8010.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

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

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

* Re: [PATCH 3/3] rtc: rx8010: Fix for incorrect return value
  2017-11-03 17:32 ` [PATCH 3/3] rtc: rx8010: Fix for incorrect return value Akshay Bhat
@ 2017-11-08  2:30   ` Alexandre Belloni
  2017-11-08 20:00     ` Akshay Bhat
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Belloni @ 2017-11-08  2:30 UTC (permalink / raw)
  To: Akshay Bhat; +Cc: a.zummo, linux-rtc, linux-kernel

On 03/11/2017 at 13:32:41 -0400, Akshay Bhat wrote:
> The err variable is not being reset after a successful read. Explicitly
> reset err variable to account for all return paths.
> 
> Reported-by: Jens-Peter Oswald <oswald@lre.de>
> Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
> ---
>  drivers/rtc/rtc-rx8010.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
> index 2e06e5f..1ce2078 100644
> --- a/drivers/rtc/rtc-rx8010.c
> +++ b/drivers/rtc/rtc-rx8010.c
> @@ -223,6 +223,7 @@ static int rx8010_init_client(struct i2c_client *client)
>  					    2, ctrl);
>  	if (err != 2)
>  		return err < 0 ? err : -EIO;
> +	err = 0;

Isn't it simpler to make the function return 0 instead of err at the end?

>  
>  	if (ctrl[0] & RX8010_FLAG_VLF)
>  		dev_warn(&client->dev, "Frequency stop was detected\n");
> @@ -261,6 +262,7 @@ static int rx8010_read_alarm(struct device *dev, struct rtc_wkalrm *t)
>  	err = i2c_smbus_read_i2c_block_data(client, RX8010_ALMIN, 3, alarmvals);
>  	if (err != 3)
>  		return err < 0 ? err : -EIO;
> +	err = 0;

ditto

>  
>  	flagreg = i2c_smbus_read_byte_data(client, RX8010_FLAG);
>  	if (flagreg < 0)
> -- 
> 2.7.4
> 

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

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

* Re: [PATCH 3/3] rtc: rx8010: Fix for incorrect return value
  2017-11-08  2:30   ` Alexandre Belloni
@ 2017-11-08 20:00     ` Akshay Bhat
  0 siblings, 0 replies; 7+ messages in thread
From: Akshay Bhat @ 2017-11-08 20:00 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Alessandro Zummo, linux-rtc, linux-kernel

On Tue, Nov 7, 2017 at 9:30 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> On 03/11/2017 at 13:32:41 -0400, Akshay Bhat wrote:
>>       if (err != 2)
>>               return err < 0 ? err : -EIO;
>> +     err = 0;
>
> Isn't it simpler to make the function return 0 instead of err at the end?

Makes sense, fixed in v2 patch, thanks.

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

end of thread, other threads:[~2017-11-08 20:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 17:32 [PATCH 1/3] rtc: rx8010: Remove duplicate define Akshay Bhat
2017-11-03 17:32 ` [PATCH 2/3] rtc: rx8010: Specify correct address for RX8010_RESV31 Akshay Bhat
2017-11-08  2:28   ` Alexandre Belloni
2017-11-03 17:32 ` [PATCH 3/3] rtc: rx8010: Fix for incorrect return value Akshay Bhat
2017-11-08  2:30   ` Alexandre Belloni
2017-11-08 20:00     ` Akshay Bhat
2017-11-08  2:28 ` [PATCH 1/3] rtc: rx8010: Remove duplicate define 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).