From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init
Date: Fri, 19 Oct 2018 21:47:57 +0200 [thread overview]
Message-ID: <20181019194757.GN17341@piout.net> (raw)
In-Reply-To: <20181018214207.4223-1-natechancellor@gmail.com>
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
next prev parent reply other threads:[~2018-10-19 19:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2018-10-19 20:43 ` [PATCH v2] rtc: s35390a: Change buf's type to u8 " Nathan Chancellor
2018-10-22 17:30 ` Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181019194757.GN17341@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=natechancellor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).