Re: [PATCH 3.16-stable 11/87] iio: fix printk format string warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2017-05-05 at 21:46 +0200, Arnd Bergmann wrote:
> On 3.16, we get this warning:
> 
> drivers/iio/industrialio-core.c: In function 'iio_format_value':
> drivers/iio/industrialio-core.c:408:30: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long int' [-Werror=format=]
> 
> Upstream commit 8f57e4d930d4 ("include/linux/kernel.h: change abs() macro
> so it uses consistent return type") addressed this in a more verbose
> way, but here we can simply add a type cast to shut up the warning.

I'm skipping this one because I have now cherry-picked that commit.

Ben.

> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
>  drivers/iio/industrialio-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 230cbdda6ce1..669c27d93049 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -405,7 +405,7 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals)
>  	case IIO_VAL_FRACTIONAL:
>  		tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
>  		vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]);
> -		return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1]));
> +		return sprintf(buf, "%d.%09ld\n", vals[0], abs(vals[1]));
>  	case IIO_VAL_FRACTIONAL_LOG2:
>  		tmp = (s64)vals[0] * 1000000000LL >> vals[1];
>  		vals[1] = do_div(tmp, 1000000000LL);
-- 
Ben Hutchings
It is a miracle that curiosity survives formal education. - Albert
Einstein

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]