All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: kernel test robot <lkp@intel.com>
Cc: Dmitry Rokosov <DDRokosov@sberdevices.ru>, <llvm@lists.linux.dev>,
	<kbuild-all@lists.01.org>, <linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [jic23-iio:testing 124/129] drivers/iio/accel/msa311.c:993:24: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int'
Date: Tue, 30 Aug 2022 11:03:29 +0100	[thread overview]
Message-ID: <20220830110329.00000d18@huawei.com> (raw)
In-Reply-To: <202208290618.wU7mHfOp-lkp@intel.com>

On Mon, 29 Aug 2022 06:25:53 +0800
kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> head:   fc32c348a52157665cd8f3f060669ef4e8a03cd4
> commit: 1a622d75985c5950a470edc50c7ad7c10e79a1d3 [124/129] iio: add MEMSensing MSA311 3-axis accelerometer driver
> config: powerpc-randconfig-r024-20220829 (https://download.01.org/0day-ci/archive/20220829/202208290618.wU7mHfOp-lkp@intel.com/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project a2100daf12fb980a29fd1a9c85ccf8eaaaf79730)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install powerpc cross compiling tool for clang build
>         # apt-get install binutils-powerpc-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=1a622d75985c5950a470edc50c7ad7c10e79a1d3
>         git remote add jic23-iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
>         git fetch --no-tags jic23-iio testing
>         git checkout 1a622d75985c5950a470edc50c7ad7c10e79a1d3
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/iio/accel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/iio/accel/msa311.c:993:24: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]  
>                                               "msa311-%hhx", partid);
>                                                       ~~~~   ^~~~~~
>                                                       %x
>    1 warning generated.
> 
> 
> vim +993 drivers/iio/accel/msa311.c
> 
>    977	
>    978	static int msa311_check_partid(struct msa311_priv *msa311)
>    979	{
>    980		struct device *dev = msa311->dev;
>    981		unsigned int partid;
>    982		int err;
>    983	
>    984		err = regmap_read(msa311->regs, MSA311_PARTID_REG, &partid);
>    985		if (err)
>    986			return dev_err_probe(dev, err, "failed to read partid\n");
>    987	
>    988		if (partid != MSA311_WHO_AM_I)
>    989			dev_warn(dev, "invalid partid (%#x), expected (%#x)\n",
>    990				 partid, MSA311_WHO_AM_I);
>    991	
>    992		msa311->chip_name = devm_kasprintf(dev, GFP_KERNEL,
>  > 993						   "msa311-%hhx", partid);  

Dmitry,

I'm thinking intent here was to limit range of what was printed. Maybe better to use
local u8 variable or cast?

I can fix it up if that's fine with you - or even better send me a patch that fixes
it however you prefer!

Jonathan


>    994		if (!msa311->chip_name)
>    995			return dev_err_probe(dev, -ENOMEM, "can't alloc chip name\n");
>    996	
>    997		return 0;
>    998	}
>    999	
> 


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: kbuild-all@lists.01.org
Subject: Re: [jic23-iio:testing 124/129] drivers/iio/accel/msa311.c:993:24: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int'
Date: Tue, 30 Aug 2022 11:03:29 +0100	[thread overview]
Message-ID: <20220830110329.00000d18@huawei.com> (raw)
In-Reply-To: <202208290618.wU7mHfOp-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3114 bytes --]

On Mon, 29 Aug 2022 06:25:53 +0800
kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
> head:   fc32c348a52157665cd8f3f060669ef4e8a03cd4
> commit: 1a622d75985c5950a470edc50c7ad7c10e79a1d3 [124/129] iio: add MEMSensing MSA311 3-axis accelerometer driver
> config: powerpc-randconfig-r024-20220829 (https://download.01.org/0day-ci/archive/20220829/202208290618.wU7mHfOp-lkp(a)intel.com/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project a2100daf12fb980a29fd1a9c85ccf8eaaaf79730)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install powerpc cross compiling tool for clang build
>         # apt-get install binutils-powerpc-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=1a622d75985c5950a470edc50c7ad7c10e79a1d3
>         git remote add jic23-iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
>         git fetch --no-tags jic23-iio testing
>         git checkout 1a622d75985c5950a470edc50c7ad7c10e79a1d3
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/iio/accel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/iio/accel/msa311.c:993:24: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]  
>                                               "msa311-%hhx", partid);
>                                                       ~~~~   ^~~~~~
>                                                       %x
>    1 warning generated.
> 
> 
> vim +993 drivers/iio/accel/msa311.c
> 
>    977	
>    978	static int msa311_check_partid(struct msa311_priv *msa311)
>    979	{
>    980		struct device *dev = msa311->dev;
>    981		unsigned int partid;
>    982		int err;
>    983	
>    984		err = regmap_read(msa311->regs, MSA311_PARTID_REG, &partid);
>    985		if (err)
>    986			return dev_err_probe(dev, err, "failed to read partid\n");
>    987	
>    988		if (partid != MSA311_WHO_AM_I)
>    989			dev_warn(dev, "invalid partid (%#x), expected (%#x)\n",
>    990				 partid, MSA311_WHO_AM_I);
>    991	
>    992		msa311->chip_name = devm_kasprintf(dev, GFP_KERNEL,
>  > 993						   "msa311-%hhx", partid);  

Dmitry,

I'm thinking intent here was to limit range of what was printed. Maybe better to use
local u8 variable or cast?

I can fix it up if that's fine with you - or even better send me a patch that fixes
it however you prefer!

Jonathan


>    994		if (!msa311->chip_name)
>    995			return dev_err_probe(dev, -ENOMEM, "can't alloc chip name\n");
>    996	
>    997		return 0;
>    998	}
>    999	
> 

  reply	other threads:[~2022-08-30 10:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-28 22:25 [jic23-iio:testing 124/129] drivers/iio/accel/msa311.c:993:24: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' kernel test robot
2022-08-30 10:03 ` Jonathan Cameron [this message]
2022-08-30 10:03   ` Jonathan Cameron
2022-08-30 12:45   ` Andy Shevchenko
2022-08-30 12:45     ` Andy Shevchenko
2022-08-30 12:51     ` Andy Shevchenko
2022-08-30 12:51       ` Andy Shevchenko
2022-08-31  0:24     ` Dmitry Rokosov
2022-08-31  0:24       ` Dmitry Rokosov
2022-08-31  8:38       ` Jonathan Cameron
2022-08-31  8:38         ` Jonathan Cameron
2022-08-31 21:04         ` Dmitry Rokosov
2022-08-31 21:04           ` Dmitry Rokosov

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=20220830110329.00000d18@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=DDRokosov@sberdevices.ru \
    --cc=andy.shevchenko@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.