From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [agd5f:i2c_rework 39/48] drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:1852:3: warning: variable 'bytes_to_transfer' is uninitialized when used here
Date: Mon, 25 Jan 2021 20:41:42 +0800 [thread overview]
Message-ID: <202101252036.wdhogGrd-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 11953 bytes --]
tree: https://gitlab.freedesktop.org/agd5f/linux.git i2c_rework
head: cf3d8d5d50a925740a730f57b8b617fab7e7e75a
commit: e50590af5457e7bc3b5010ce8921bb000726f415 [39/48] drm/amdgpu/pm: rework i2c xfers on arcturus (v3)
config: s390-randconfig-r024-20210125 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 12d0753aca22896fda2cf76781b0ee0524d55065)
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
git remote add agd5f https://gitlab.freedesktop.org/agd5f/linux.git
git fetch --no-tags agd5f i2c_rework
git checkout e50590af5457e7bc3b5010ce8921bb000726f415
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:27:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:52:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:80:
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:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
^
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:27:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:52:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:80:
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:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
^
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:27:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:52:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:80:
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:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
^
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:27:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:52:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:80:
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:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
__fswab32(x))
^
In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:27:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:52:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:80:
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/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:1852:3: warning: variable 'bytes_to_transfer' is uninitialized when used here [-Wuninitialized]
bytes_to_transfer += min(msgs[i].len, available_bytes);
^~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c:1842:23: note: initialize the variable 'bytes_to_transfer' to silence this warning
u16 bytes_to_transfer, remaining_bytes, msg_bytes;
^
= 0
21 warnings generated.
vim +/bytes_to_transfer +1852 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/arcturus_ppt.c
1834
1835 static int arcturus_i2c_xfer(struct i2c_adapter *i2c_adap,
1836 struct i2c_msg *msgs, int num)
1837 {
1838 struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
1839 struct smu_table_context *smu_table = &adev->smu.smu_table;
1840 struct smu_table *table = &smu_table->driver_table;
1841 SwI2cRequest_t *req, *res = (SwI2cRequest_t *)table->cpu_addr;
1842 u16 bytes_to_transfer, remaining_bytes, msg_bytes;
1843 u16 available_bytes = MAX_SW_I2C_COMMANDS;
1844 int i, j, r, c;
1845 u8 slave;
1846
1847 /* only support a single slave addr per transaction */
1848 slave = msgs[0].addr;
1849 for (i = 0; i < num; i++) {
1850 if (slave != msgs[i].addr)
1851 return -EINVAL;
> 1852 bytes_to_transfer += min(msgs[i].len, available_bytes);
1853 available_bytes -= bytes_to_transfer;
1854 }
1855
1856 req = kzalloc(sizeof(*req), GFP_KERNEL);
1857 if (!req)
1858 return -ENOMEM;
1859
1860 req->I2CcontrollerPort = 1;
1861 req->I2CSpeed = I2C_SPEED_FAST_400K;
1862 req->SlaveAddress = slave << 1; /* 8 bit addresses */
1863 req->NumCmds = bytes_to_transfer;
1864
1865 remaining_bytes = bytes_to_transfer;
1866 c = 0;
1867 for (i = 0; i < num; i++) {
1868 struct i2c_msg *msg = &msgs[i];
1869
1870 msg_bytes = min(msg->len, remaining_bytes);
1871 for (j = 0; j < msg_bytes; j++) {
1872 SwI2cCmd_t *cmd = &req->SwI2cCmds[c++];
1873
1874 remaining_bytes--;
1875 if (!(msg[i].flags & I2C_M_RD)) {
1876 /* write */
1877 cmd->CmdConfig |= I2C_CMD_WRITE;
1878 cmd->RegisterAddr = msg->buf[j];
1879 }
1880 if ((msg[i].flags & I2C_M_STOP) ||
1881 (!remaining_bytes))
1882 cmd->CmdConfig |= CMDCONFIG_STOP_MASK;
1883 if ((i > 0) && !(msg[i].flags & I2C_M_NOSTART))
1884 cmd->CmdConfig |= CMDCONFIG_RESTART_BIT;
1885 }
1886 }
1887 mutex_lock(&adev->smu.mutex);
1888 r = smu_cmn_update_table(&adev->smu, SMU_TABLE_I2C_COMMANDS, 0, &req, true);
1889 mutex_unlock(&adev->smu.mutex);
1890 if (r)
1891 goto fail;
1892
1893 remaining_bytes = bytes_to_transfer;
1894 c = 0;
1895 for (i = 0; i < num; i++) {
1896 struct i2c_msg *msg = &msgs[i];
1897
1898 msg_bytes = min(msg->len, remaining_bytes);
1899 for (j = 0; j < msg_bytes; j++) {
1900 SwI2cCmd_t *cmd = &res->SwI2cCmds[c++];
1901
1902 remaining_bytes--;
1903 if (msg[i].flags & I2C_M_RD)
1904 msg->buf[j] = cmd->Data;
1905 }
1906 }
1907 r = bytes_to_transfer;
1908
1909 fail:
1910 kfree(req);
1911
1912 return r;
1913 }
1914
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30922 bytes --]
reply other threads:[~2021-01-25 12:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202101252036.wdhogGrd-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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.