From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [agd5f:i2c_rework 38/48] drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c:2714:3: warning: variable 'bytes_to_transfer' is uninitialized when used here
Date: Mon, 25 Jan 2021 19:06:05 +0800 [thread overview]
Message-ID: <202101251956.GaAZFdjo-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 11945 bytes --]
tree: https://gitlab.freedesktop.org/agd5f/linux.git i2c_rework
head: cf3d8d5d50a925740a730f57b8b617fab7e7e75a
commit: a721f1cc3ea5f1420cf3d28996632212b9f3ef90 [38/48] drm/amdgpu/pm: rework i2c xfers on sienna cichlid (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 a721f1cc3ea5f1420cf3d28996632212b9f3ef90
# 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 >>):
#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: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/sienna_cichlid_ppt.c:27:
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/sienna_cichlid_ppt.c:27:
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/sienna_cichlid_ppt.c:27:
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/sienna_cichlid_ppt.c:27:
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/sienna_cichlid_ppt.c:27:
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/sienna_cichlid_ppt.c:2714: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/sienna_cichlid_ppt.c:2704: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 +2714 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c
2696
2697 static int sienna_cichlid_i2c_xfer(struct i2c_adapter *i2c_adap,
2698 struct i2c_msg *msgs, int num)
2699 {
2700 struct amdgpu_device *adev = to_amdgpu_device(i2c_adap);
2701 struct smu_table_context *smu_table = &adev->smu.smu_table;
2702 struct smu_table *table = &smu_table->driver_table;
2703 SwI2cRequest_t *req, *res = (SwI2cRequest_t *)table->cpu_addr;
2704 u16 bytes_to_transfer, remaining_bytes, msg_bytes;
2705 u16 available_bytes = MAX_SW_I2C_COMMANDS;
2706 int i, j, r, c;
2707 u8 slave;
2708
2709 /* only support a single slave addr per transaction */
2710 slave = msgs[0].addr;
2711 for (i = 0; i < num; i++) {
2712 if (slave != msgs[i].addr)
2713 return -EINVAL;
> 2714 bytes_to_transfer += min(msgs[i].len, available_bytes);
2715 available_bytes -= bytes_to_transfer;
2716 }
2717
2718 req = kzalloc(sizeof(*req), GFP_KERNEL);
2719 if (!req)
2720 return -ENOMEM;
2721
2722 req->I2CcontrollerPort = 1;
2723 req->I2CSpeed = I2C_SPEED_FAST_400K;
2724 req->SlaveAddress = slave << 1; /* 8 bit addresses */
2725 req->NumCmds = bytes_to_transfer;
2726
2727 remaining_bytes = bytes_to_transfer;
2728 c = 0;
2729 for (i = 0; i < num; i++) {
2730 struct i2c_msg *msg = &msgs[i];
2731
2732 msg_bytes = min(msg->len, remaining_bytes);
2733 for (j = 0; j < msg_bytes; j++) {
2734 SwI2cCmd_t *cmd = &req->SwI2cCmds[c++];
2735
2736 remaining_bytes--;
2737 if (!(msg[i].flags & I2C_M_RD)) {
2738 /* write */
2739 cmd->CmdConfig |= CMDCONFIG_READWRITE_MASK;
2740 cmd->ReadWriteData = msg->buf[j];
2741 }
2742 if ((msg[i].flags & I2C_M_STOP) ||
2743 (!remaining_bytes))
2744 cmd->CmdConfig |= CMDCONFIG_STOP_MASK;
2745 if ((i > 0) && !(msg[i].flags & I2C_M_NOSTART))
2746 cmd->CmdConfig |= CMDCONFIG_RESTART_BIT;
2747 }
2748 }
2749 mutex_lock(&adev->smu.mutex);
2750 r = smu_cmn_update_table(&adev->smu, SMU_TABLE_I2C_COMMANDS, 0, &req, true);
2751 mutex_unlock(&adev->smu.mutex);
2752 if (r)
2753 goto fail;
2754
2755 remaining_bytes = bytes_to_transfer;
2756 c = 0;
2757 for (i = 0; i < num; i++) {
2758 struct i2c_msg *msg = &msgs[i];
2759
2760 msg_bytes = min(msg->len, remaining_bytes);
2761 for (j = 0; j < msg_bytes; j++) {
2762 SwI2cCmd_t *cmd = &res->SwI2cCmds[c++];
2763
2764 remaining_bytes--;
2765 if (msg[i].flags & I2C_M_RD)
2766 msg->buf[j] = cmd->ReadWriteData;
2767 }
2768 }
2769 r = bytes_to_transfer;
2770
2771 fail:
2772 kfree(req);
2773
2774 return r;
2775 }
2776
---
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 11:06 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=202101251956.GaAZFdjo-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.