Re: [PATCH v7 4/8] phy: fsl: Add Lynx 10G SerDes driver
From: kernel test robot <hidden>
Date: 2022-10-20 17:05:52
Also in:
linux-devicetree, linux-phy, llvm
Hi Sean, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on clk/clk-next krzk/for-next krzk-dt/for-next linus/master v6.1-rc1 next-20221020] [cannot apply to shawnguo/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/phy-Add-support-for-Lynx-10G-SerDes/20221019-071314 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next patch link: https://lore.kernel.org/r/20221018231112.2142074-5-sean.anderson%40seco.com patch subject: [PATCH v7 4/8] phy: fsl: Add Lynx 10G SerDes driver config: powerpc-allmodconfig compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) 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 powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/61841850159f548e5ce4940701a4c75e9ff1a4b1 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Sean-Anderson/phy-Add-support-for-Lynx-10G-SerDes/20221019-071314 git checkout 61841850159f548e5ce4940701a4c75e9ff1a4b1 # 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=powerpc SHELL=/bin/bash drivers/net/ethernet/renesas/ drivers/phy/freescale/ drivers/phy/renesas/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot [off-list ref] All warnings (new ones prefixed by >>):
quoted
drivers/phy/freescale/phy-fsl-lynx-10g.c:829:19: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
"reg", fwnode, ret);
^~~
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
drivers/phy/freescale/phy-fsl-lynx-10g.c:813:24: note: initialize the variable 'ret' to silence this warning
int i, lane_count, ret;
^
= 0
drivers/phy/freescale/phy-fsl-lynx-10g.c:1045:6: warning: variable 'base' set but not used [-Wunused-but-set-variable]
u32 base, pccr, off, shift, mask;
^
2 warnings generated.
vim +/ret +829 drivers/phy/freescale/phy-fsl-lynx-10g.c
809
810 static int lynx_probe_group(struct lynx_priv *serdes,
811 struct fwnode_handle *fwnode)
812 {
813 int i, lane_count, ret;
814 struct device *dev = serdes->dev;
815 struct fwnode_handle *mode_node;
816 struct lynx_group *group;
817 struct lynx_mode *modes;
818 struct phy *phy;
819 u32 *lanes = NULL;
820
821 group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL);
822 if (!group)
823 return -ENOMEM;
824 group->serdes = serdes;
825
826 lane_count = fwnode_property_count_u32(fwnode, "reg");
827 if (lane_count < 0) {
828 dev_err(dev, "could not read %s from %pfwP: %d\n",
> 829 "reg", fwnode, ret);
830 return lane_count;
831 }
832
833 lanes = kcalloc(lane_count, sizeof(*lanes), GFP_KERNEL);
834 if (!lanes)
835 return -ENOMEM;
836
837 ret = fwnode_property_read_u32_array(fwnode, "reg", lanes, lane_count);
838 if (ret) {
839 dev_err(dev, "could not read %s from %pfwP: %d\n",
840 "reg", fwnode, ret);
841 goto out;
842 }
843
844 group->first_lane = lanes[0];
845 group->last_lane = lanes[lane_count - 1];
846 for (i = 0; i < lane_count; i++) {
847 u32 prots, gcr0;
848
849 if (lanes[i] > serdes->cfg->lanes) {
850 ret = -EINVAL;
851 dev_err(dev, "lane %d not in range 0 to %u\n",
852 i, serdes->cfg->lanes);
853 goto out;
854 }
855
856 if (lanes[i] != group->first_lane +
857 i * !!(group->last_lane - group->first_lane)) {
858 ret = -EINVAL;
859 dev_err(dev, "lane %d is not monotonic\n", i);
860 goto out;
861 }
862
863 gcr0 = lynx_read(serdes, LNmGCR0(lanes[i]));
864 prots = FIELD_GET(LNmGCR0_PROTS, gcr0);
865 if (i && group->prots != prots) {
866 ret = -EIO;
867 dev_err(dev, "lane %d protocol does not match lane 0\n",
868 lanes[i]);
869 goto out;
870 }
871 group->prots = prots;
872 }
873
874 fwnode_for_each_child_node(fwnode, mode_node)
875 group->mode_count++;
876
877 modes = devm_kcalloc(dev, group->mode_count, sizeof(*group->modes),
878 GFP_KERNEL);
879 if (!modes) {
880 ret = -ENOMEM;
881 goto out;
882 }
883
884 i = 0;
885 fwnode_for_each_child_node(fwnode, mode_node) {
886 struct lynx_mode *mode = &modes[i++];
887 u32 val;
888
889 ret = lynx_read_u32(dev, mode_node, "fsl,pccr", &val);
890 if (ret)
891 goto out;
892 mode->pccr = val;
893
894 ret = lynx_read_u32(dev, mode_node, "fsl,index", &val);
895 if (ret)
896 goto out;
897 mode->idx = val;
898
899 ret = lynx_read_u32(dev, mode_node, "fsl,cfg", &val);
900 if (ret)
901 goto out;
902 mode->cfg = val;
903
904 ret = lynx_read_u32(dev, mode_node, "phy-type", &val);
905 if (ret)
906 goto out;
907
908 ret = serdes->cfg->mode_init(serdes, mode, val);
909 if (ret)
910 goto out;
911
912 dev_dbg(dev, "mode PCCR%X.%s%c_CFG=%x on lanes %u to %u\n",
913 mode->pccr, lynx_proto_str[__ffs(mode->protos)],
914 'A' + mode->idx, mode->cfg, group->first_lane,
915 group->last_lane);
916 }
917
918 WARN_ON(i != group->mode_count);
919 group->modes = modes;
920
921 /* Deselect anything configured by the RCW/bootloader */
922 for (i = 0; i < group->mode_count; i++)
923 serdes->cfg->mode_apply(serdes, &group->modes[i],
924 LYNX_PROTO_NONE);
925
926 /* Disable the lanes for now */
927 lynx_power_off_group(group);
928
929 phy = devm_phy_create(dev, to_of_node(fwnode), &lynx_phy_ops);
930 ret = PTR_ERR_OR_ZERO(phy);
931 if (ret)
932 dev_err_probe(dev, ret, "could not create phy\n");
933 else
934 phy_set_drvdata(phy, group);
935
936 out:
937 kfree(lanes);
938 return ret;
939 }
940
--
0-DAY CI Kernel Test Service
https://01.org/lkp