diff mbox series

[v2] rtc: s35390a: Change buf's type to u8 in s35390a_init

Message ID 20181019204344.28080-1-natechancellor@gmail.com
State Accepted
Headers show
Series [v2] rtc: s35390a: Change buf's type to u8 in s35390a_init | expand

Commit Message

Nathan Chancellor Oct. 19, 2018, 8:43 p.m. UTC
Clang warns:

drivers/rtc/rtc-s35390a.c:124:27: warning: implicit conversion from
'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion]
        buf = S35390A_FLAG_RESET | S35390A_FLAG_24H;
            ~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
1 warning generated.

Update buf to be an unsigned 8-bit integer, which matches the buf member
in struct i2c_msg.

https://github.com/ClangBuiltLinux/linux/issues/145
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

* Use u8 instead of unsigned char, as it's clearer that this is an
  integer value and it's shorter.

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

Comments

Alexandre Belloni Oct. 22, 2018, 5:30 p.m. UTC | #1
On 19/10/2018 13:43:45-0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/rtc/rtc-s35390a.c:124:27: warning: implicit conversion from
> 'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion]
>         buf = S35390A_FLAG_RESET | S35390A_FLAG_24H;
>             ~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
> 1 warning generated.
> 
> Update buf to be an unsigned 8-bit integer, which matches the buf member
> in struct i2c_msg.
> 
> https://github.com/ClangBuiltLinux/linux/issues/145
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 
> v1 -> v2:
> 
> * Use u8 instead of unsigned char, as it's clearer that this is an
>   integer value and it's shorter.
> 
>  drivers/rtc/rtc-s35390a.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 77feb603cd4c..3c64dbb08109 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -108,7 +108,7 @@  static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len)
 
 static int s35390a_init(struct s35390a *s35390a)
 {
-	char buf;
+	u8 buf;
 	int ret;
 	unsigned initcount = 0;