Thread (35 messages) 35 messages, 7 authors, 2023-03-03

Re: [PATCH v9 05/10] phy: fsl: Add Lynx 10G SerDes driver

From: kernel test robot <hidden>
Date: 2023-01-03 18:31:38
Also in: linux-devicetree, linux-phy, llvm, oe-kbuild-all

Hi Sean,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.2-rc2 next-20221226]
[cannot apply to shawnguo/for-next clk/clk-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/dt-bindings-phy-Add-2500BASE-X-and-10GBASE-R/20221230-080233
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20221230000139.2846763-6-sean.anderson%40seco.com
patch subject: [PATCH v9 05/10] phy: fsl: Add Lynx 10G SerDes driver
config: arm64-randconfig-r004-20230101
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 7a8cb6cd4e3ff8aaadebff2b9d3ee9e2a326d444)
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://github.com/intel-lab-lkp/linux/commit/8b4ae2cb72763ac880135b80a765e5cb4bb054b5
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sean-Anderson/dt-bindings-phy-Add-2500BASE-X-and-10GBASE-R/20221230-080233
        git checkout 8b4ae2cb72763ac880135b80a765e5cb4bb054b5
        # 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=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/phy/freescale/

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:880: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:868:24: note: initialize the variable 'ret' to silence this warning
           int i, lane_count, ret;
                                 ^
                                  = 0
   1 warning generated.


vim +/ret +880 drivers/phy/freescale/phy-fsl-lynx-10g.c

   864	
   865	static int lynx_probe_group(struct lynx_priv *serdes, struct lynx_group *group,
   866				    struct fwnode_handle *fwnode, bool initialize)
   867	{
   868		int i, lane_count, ret;
   869		struct device *dev = serdes->dev;
   870		struct fwnode_handle *mode_node;
   871		struct lynx_mode *modes;
   872		struct phy *phy;
   873		u32 *lanes = NULL;
   874	
   875		group->serdes = serdes;
   876	
   877		lane_count = fwnode_property_count_u32(fwnode, "reg");
   878		if (lane_count < 0) {
   879			dev_err(dev, "could not read %s from %pfwP: %d\n",
 > 880				"reg", fwnode, ret);
   881			return lane_count;
   882		}
   883	
   884		lanes = kcalloc(lane_count, sizeof(*lanes), GFP_KERNEL);
   885		if (!lanes)
   886			return -ENOMEM;
   887	
   888		ret = fwnode_property_read_u32_array(fwnode, "reg", lanes, lane_count);
   889		if (ret) {
   890			dev_err(dev, "could not read %s from %pfwP: %d\n",
   891				"reg", fwnode, ret);
   892			goto out;
   893		}
   894	
   895		group->first_lane = lanes[0];
   896		group->last_lane = lanes[lane_count - 1];
   897		for (i = 0; i < lane_count; i++) {
   898			u32 prots, gcr0;
   899	
   900			if (lanes[i] > serdes->cfg->lanes) {
   901				ret = -EINVAL;
   902				dev_err(dev, "lane %d not in range 0 to %u\n",
   903					i, serdes->cfg->lanes);
   904				goto out;
   905			}
   906	
   907			if (lanes[i] != group->first_lane +
   908					i * !!(group->last_lane - group->first_lane)) {
   909				ret = -EINVAL;
   910				dev_err(dev, "lane %d is not monotonic\n", i);
   911				goto out;
   912			}
   913	
   914			gcr0 = lynx_read(serdes, LNmGCR0(lanes[i]));
   915			prots = FIELD_GET(LNmGCR0_PROTS, gcr0);
   916			if (i && group->prots != prots) {
   917				ret = -EIO;
   918				dev_err(dev, "lane %d protocol does not match lane 0\n",
   919					lanes[i]);
   920				goto out;
   921			}
   922			group->prots = prots;
   923		}
   924	
   925		fwnode_for_each_child_node(fwnode, mode_node)
   926			group->mode_count++;
   927	
   928		modes = devm_kcalloc(dev, group->mode_count, sizeof(*group->modes),
   929				     GFP_KERNEL);
   930		if (!modes) {
   931			ret = -ENOMEM;
   932			goto out;
   933		}
   934	
   935		i = 0;
   936		fwnode_for_each_child_node(fwnode, mode_node) {
   937			struct lynx_mode *mode = &modes[i++];
   938			u32 val;
   939	
   940			ret = lynx_read_u32(dev, mode_node, "fsl,pccr", &val);
   941			if (ret)
   942				goto out;
   943			mode->pccr = val;
   944	
   945			ret = lynx_read_u32(dev, mode_node, "fsl,index", &val);
   946			if (ret)
   947				goto out;
   948			mode->idx = val;
   949	
   950			ret = lynx_read_u32(dev, mode_node, "fsl,cfg", &val);
   951			if (ret)
   952				goto out;
   953			mode->cfg = val;
   954	
   955			ret = lynx_read_u32(dev, mode_node, "fsl,type", &val);
   956			if (ret)
   957				goto out;
   958	
   959			ret = serdes->cfg->mode_init(serdes, mode, val);
   960			if (ret)
   961				goto out;
   962	
   963			dev_dbg(dev, "mode PCCR%X.%s%c_CFG=%x on lanes %u to %u\n",
   964				mode->pccr, lynx_proto_str[__ffs(mode->protos)],
   965				'A' + mode->idx, mode->cfg, group->first_lane,
   966				group->last_lane);
   967		}
   968	
   969		WARN_ON(i != group->mode_count);
   970		group->modes = modes;
   971	
   972		if (initialize) {
   973			/* Deselect anything configured by the RCW/bootloader */
   974			for (i = 0; i < group->mode_count; i++)
   975				serdes->cfg->mode_apply(serdes, &group->modes[i],
   976							LYNX_PROTO_NONE);
   977	
   978			/* Disable the lanes for now */
   979			lynx_power_off_group(group);
   980			group->initialized = true;
   981		}
   982	
   983		phy = devm_phy_create(dev, to_of_node(fwnode), &lynx_phy_ops);
   984		ret = PTR_ERR_OR_ZERO(phy);
   985		if (ret)
   986			dev_err_probe(dev, ret, "could not create phy\n");
   987		else
   988			phy_set_drvdata(phy, group);
   989	
   990	out:
   991		kfree(lanes);
   992		return ret;
   993	}
   994	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help