lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202412031033.V6Bj93BG-lkp@intel.com>
Date: Tue, 3 Dec 2024 10:03:59 +0800
From: kernel test robot <lkp@...el.com>
To: Aswath Govindraju <a-govindraju@...com>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	linux-kernel@...r.kernel.org, Vinod Koul <vkoul@...nel.org>
Subject: drivers/mux/adgs1408.c:62:12: warning: cast to smaller integer type
 'enum adgs1408_chip_id' from 'const void *'

Hi Aswath,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cdd30ebb1b9f36159d66f088b61aee264e649d7a
commit: e4d4371253029528c02bfb43a46c252e1c3d035f phy: phy-can-transceiver: Add support for setting mux
date:   2 years, 8 months ago
config: x86_64-buildonly-randconfig-001-20240107 (https://download.01.org/0day-ci/archive/20241203/202412031033.V6Bj93BG-lkp@intel.com/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412031033.V6Bj93BG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412031033.V6Bj93BG-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mux/adgs1408.c:62:12: warning: cast to smaller integer type 'enum adgs1408_chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast]
      62 |         chip_id = (enum adgs1408_chip_id)device_get_match_data(dev);
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +62 drivers/mux/adgs1408.c

8b9ce6954c05e3 Mircea Caprioru     2018-08-01   52  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   53  static int adgs1408_probe(struct spi_device *spi)
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   54  {
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   55  	struct device *dev = &spi->dev;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   56  	enum adgs1408_chip_id chip_id;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   57  	struct mux_chip *mux_chip;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   58  	struct mux_control *mux;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   59  	s32 idle_state;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   60  	int ret;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   61  
b7820ae2d2929d Andy Shevchenko     2020-05-29  @62  	chip_id = (enum adgs1408_chip_id)device_get_match_data(dev);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   63  	if (!chip_id)
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   64  		chip_id = spi_get_device_id(spi)->driver_data;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   65  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   66  	mux_chip = devm_mux_chip_alloc(dev, 1, 0);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   67  	if (IS_ERR(mux_chip))
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   68  		return PTR_ERR(mux_chip);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   69  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   70  	mux_chip->ops = &adgs1408_ops;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   71  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   72  	ret = adgs1408_spi_reg_write(spi, ADGS1408_SW_DATA, ADGS1408_DISABLE);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   73  	if (ret < 0)
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   74  		return ret;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   75  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   76  	ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   77  	if (ret < 0)
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   78  		idle_state = MUX_IDLE_AS_IS;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   79  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   80  	mux = mux_chip->mux;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   81  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   82  	if (chip_id == ADGS1408)
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   83  		mux->states = 8;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   84  	else
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   85  		mux->states = 4;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   86  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   87  	switch (idle_state) {
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   88  	case MUX_IDLE_DISCONNECT:
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   89  	case MUX_IDLE_AS_IS:
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   90  	case 0 ... 7:
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   91  		/* adgs1409 supports only 4 states */
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   92  		if (idle_state < mux->states) {
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   93  			mux->idle_state = idle_state;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   94  			break;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   95  		}
df561f6688fef7 Gustavo A. R. Silva 2020-08-23   96  		fallthrough;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   97  	default:
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   98  		dev_err(dev, "invalid idle-state %d\n", idle_state);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01   99  		return -EINVAL;
8b9ce6954c05e3 Mircea Caprioru     2018-08-01  100  	}
8b9ce6954c05e3 Mircea Caprioru     2018-08-01  101  
8b9ce6954c05e3 Mircea Caprioru     2018-08-01  102  	return devm_mux_chip_register(dev, mux_chip);
8b9ce6954c05e3 Mircea Caprioru     2018-08-01  103  }
8b9ce6954c05e3 Mircea Caprioru     2018-08-01  104  

:::::: The code at line 62 was first introduced by commit
:::::: b7820ae2d2929d4d6e52462a820e760db35fdad6 mux: adgs1408: Add mod_devicetable.h and remove of_match_ptr

:::::: TO: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ