[pinctrl-intel:review-andy 18/19] drivers/pinctrl/pinctrl-zynqmp.c:825:13: warning: variable 'pin' is uninitialized when used here

From: kernel test robot
Date: Fri Nov 19 2021 - 03:10:35 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git review-andy
head: c25441ca551164c56b34885df3d657e2ea4d623f
commit: 9122cda6a325f80564f02b7899cc063009f5e1f9 [18/19] pinctrl: zynqmp: Unify pin naming
config: arm64-buildonly-randconfig-r004-20211118 (attached as .config)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git/commit/?id=9122cda6a325f80564f02b7899cc063009f5e1f9
git remote add pinctrl-intel https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git
git fetch --no-tags pinctrl-intel review-andy
git checkout 9122cda6a325f80564f02b7899cc063009f5e1f9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-zynqmp.c:825:13: warning: variable 'pin' is uninitialized when used here [-Wuninitialized]
if (IS_ERR(pin->name))
^~~
drivers/pinctrl/pinctrl-zynqmp.c:811:37: note: initialize the variable 'pin' to silence this warning
struct pinctrl_pin_desc *pins, *pin;
^
= NULL
1 warning generated.


vim +/pin +825 drivers/pinctrl/pinctrl-zynqmp.c

794
795 /**
796 * zynqmp_pinctrl_prepare_pin_desc() - prepare pin description info
797 * @dev: Device pointer.
798 * @zynqmp_pins: Pin information.
799 * @npins: Number of pins.
800 *
801 * Query number of pins information from firmware and prepare pin
802 * description containing pin number and pin name.
803 *
804 * Return: 0 on success else error code.
805 */
806 static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev,
807 const struct pinctrl_pin_desc
808 **zynqmp_pins,
809 unsigned int *npins)
810 {
811 struct pinctrl_pin_desc *pins, *pin;
812 char **pin_names;
813 int ret;
814 int i;
815
816 ret = zynqmp_pinctrl_get_num_pins(npins);
817 if (ret)
818 return ret;
819
820 pins = devm_kzalloc(dev, sizeof(*pins) * *npins, GFP_KERNEL);
821 if (!pins)
822 return -ENOMEM;
823
824 pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins);
> 825 if (IS_ERR(pin->name))
826 return PTR_ERR(pin_names);
827
828 for (i = 0; i < *npins; i++) {
829 pin = &pins[i];
830 pin->number = i;
831 pin->name = pin_names[i];
832 }
833
834 *zynqmp_pins = pins;
835
836 return 0;
837 }
838

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip