* [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init
@ 2018-10-18 21:42 Nathan Chancellor
2018-10-19 19:47 ` Alexandre Belloni
2018-10-19 20:43 ` [PATCH v2] rtc: s35390a: Change buf's type to u8 " Nathan Chancellor
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-18 21:42 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linux-kernel, Nathan Chancellor
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 char, which matches the size and signedness
of the buf member in struct i2c_msg (__u8).
https://github.com/ClangBuiltLinux/linux/issues/145
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/rtc/rtc-s35390a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 77feb603cd4c..9fd51337cfae 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;
+ unsigned char buf;
int ret;
unsigned initcount = 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init
2018-10-18 21:42 [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init Nathan Chancellor
@ 2018-10-19 19:47 ` Alexandre Belloni
2018-10-19 20:43 ` [PATCH v2] rtc: s35390a: Change buf's type to u8 " Nathan Chancellor
1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2018-10-19 19:47 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Alessandro Zummo, linux-rtc, linux-kernel
Hello,
On 18/10/2018 14:42:07-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 char, which matches the size and signedness
> of the buf member in struct i2c_msg (__u8).
>
> https://github.com/ClangBuiltLinux/linux/issues/145
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/rtc/rtc-s35390a.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 77feb603cd4c..9fd51337cfae 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;
> + unsigned char buf;
I would use a u8 directly which has the advantage to be shorter :)
> int ret;
> unsigned initcount = 0;
>
> --
> 2.19.1
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] rtc: s35390a: Change buf's type to u8 in s35390a_init
2018-10-18 21:42 [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init Nathan Chancellor
2018-10-19 19:47 ` Alexandre Belloni
@ 2018-10-19 20:43 ` Nathan Chancellor
2018-10-22 17:30 ` Alexandre Belloni
1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-19 20:43 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linux-kernel, Nathan Chancellor
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(-)
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;
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] rtc: s35390a: Change buf's type to u8 in s35390a_init
2018-10-19 20:43 ` [PATCH v2] rtc: s35390a: Change buf's type to u8 " Nathan Chancellor
@ 2018-10-22 17:30 ` Alexandre Belloni
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2018-10-22 17:30 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Alessandro Zummo, linux-rtc, linux-kernel
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.
--
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:[~2018-10-22 17:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 21:42 [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init Nathan Chancellor
2018-10-19 19:47 ` Alexandre Belloni
2018-10-19 20:43 ` [PATCH v2] rtc: s35390a: Change buf's type to u8 " Nathan Chancellor
2018-10-22 17:30 ` 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).