From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45EA8C433FE for ; Wed, 25 May 2022 20:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236448AbiEYUGk (ORCPT ); Wed, 25 May 2022 16:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230196AbiEYUG1 (ORCPT ); Wed, 25 May 2022 16:06:27 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB1C9252 for ; Wed, 25 May 2022 13:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653509185; x=1685045185; h=date:from:to:cc:subject:message-id:mime-version: content-transfer-encoding; bh=vydY19Q3yepHBwUkef4phItXDGR9kyBmUgvx1tRqaAo=; b=Y0xJWDKckAkMst3TjliLdnJAcO30X44dvp066ox+v5MpE0QQtJXyv+an REwM7odfJBs1WisOxpCW/FqeMCzHSr9A0G3ddSWwLETiESLbQ9jNlLLLQ q7QRwBfHhtC/xyfQfzI97diJNAatSoHKqqgtAQMReHk4qGCGicqOvHtqc YvTmMgsFc/nAcV4ni1Q6pxMSmbritpnI/NXvniL33PesCx1mV3+aUWuYr KxgMIebjnpB4oJJuyUWvvNQ8qdhZdGFHwi9I//V1j8vFr3PHrCUsonjtx hkFwseUi45fPUxy3wkraIfK8bn1Pvrp8CKADNXUkmfn3oVkjLqAIaVEMB g==; X-IronPort-AV: E=McAfee;i="6400,9594,10358"; a="253796267" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="253796267" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 13:06:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="527018179" Received: from lkp-server01.sh.intel.com (HELO db63a1be7222) ([10.239.97.150]) by orsmga003.jf.intel.com with ESMTP; 25 May 2022 13:06:15 -0700 Received: from kbuild by db63a1be7222 with local (Exim 4.95) (envelope-from ) id 1ntxGo-0003HQ-Ja; Wed, 25 May 2022 20:06:14 +0000 Date: Thu, 26 May 2022 04:05:25 +0800 From: kernel test robot To: =?iso-8859-1?Q?Andr=E9?= Almeida Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Mark Brown Subject: drivers/spi/spi-amd.c:296:21: warning: cast to smaller integer type 'enum amd_spi_versions' from 'const void *' Message-ID: <202205260455.rECeeBpC-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi André, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 64e34b50d7aeee7082287ec39f9d34d4e60f3a04 commit: 209043554915d7c51ac112a668ad1a255e1bea61 spi: amd: Add support for version AMDI0062 date: 3 months ago config: s390-randconfig-r036-20220524 (https://download.01.org/0day-ci/archive/20220526/202205260455.rECeeBpC-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d52a6e75b0c402c7f3b42a2b1b2873f151220947) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=209043554915d7c51ac112a668ad1a255e1bea61 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 209043554915d7c51ac112a668ad1a255e1bea61 # 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=s390 SHELL=/bin/bash drivers/spi/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from drivers/spi/spi-amd.c:14: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) ^ include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ In file included from drivers/spi/spi-amd.c:14: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) ^ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) ^ In file included from drivers/spi/spi-amd.c:14: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ >> drivers/spi/spi-amd.c:296:21: warning: cast to smaller integer type 'enum amd_spi_versions' from 'const void *' [-Wvoid-pointer-to-enum-cast] amd_spi->version = (enum amd_spi_versions) device_get_match_data(dev); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-amd.c:333:23: error: use of undeclared identifier 'spi_acpi_match' .acpi_match_table = spi_acpi_match, ^ 13 warnings and 1 error generated. vim +296 drivers/spi/spi-amd.c 272 273 static int amd_spi_probe(struct platform_device *pdev) 274 { 275 struct device *dev = &pdev->dev; 276 struct spi_master *master; 277 struct amd_spi *amd_spi; 278 int err = 0; 279 280 /* Allocate storage for spi_master and driver private data */ 281 master = spi_alloc_master(dev, sizeof(struct amd_spi)); 282 if (!master) { 283 dev_err(dev, "Error allocating SPI master\n"); 284 return -ENOMEM; 285 } 286 287 amd_spi = spi_master_get_devdata(master); 288 amd_spi->io_remap_addr = devm_platform_ioremap_resource(pdev, 0); 289 if (IS_ERR(amd_spi->io_remap_addr)) { 290 err = PTR_ERR(amd_spi->io_remap_addr); 291 dev_err(dev, "error %d ioremap of SPI registers failed\n", err); 292 goto err_free_master; 293 } 294 dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr); 295 > 296 amd_spi->version = (enum amd_spi_versions) device_get_match_data(dev); 297 298 /* Initialize the spi_master fields */ 299 master->bus_num = 0; 300 master->num_chipselect = 4; 301 master->mode_bits = 0; 302 master->flags = SPI_MASTER_HALF_DUPLEX; 303 master->setup = amd_spi_master_setup; 304 master->transfer_one_message = amd_spi_master_transfer; 305 306 /* Register the controller with SPI framework */ 307 err = devm_spi_register_master(dev, master); 308 if (err) { 309 dev_err(dev, "error %d registering SPI controller\n", err); 310 goto err_free_master; 311 } 312 313 return 0; 314 315 err_free_master: 316 spi_master_put(master); 317 318 return err; 319 } 320 -- 0-DAY CI Kernel Test Service https://01.org/lkp