Re: [RESEND PATCH 2/6] can: mcp25xxfd: Add Microchip MCP25XXFD CAN-FD driver infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Manivannan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.7 next-20200610]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Manivannan-Sadhasivam/Add-Microchip-MCP25XXFD-CAN-driver/20200610-155045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project bc2b70982be8f5250cd0082a7190f8b417bd4dfe)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/net/can/spi/mcp25xxfd/mcp25xxfd_base.c:69:11: warning: cast to smaller integer type 'enum mcp25xxfd_model' from 'const void *' [-Wvoid-pointer-to-enum-cast]
model = (enum mcp25xxfd_model)of_id->data;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

vim +69 drivers/net/can/spi/mcp25xxfd/mcp25xxfd_base.c

    38	
    39	static int mcp25xxfd_base_probe(struct spi_device *spi)
    40	{
    41		const struct of_device_id *of_id =
    42			of_match_device(mcp25xxfd_of_match, &spi->dev);
    43		struct mcp25xxfd_priv *priv;
    44		struct clk *clk;
    45		enum mcp25xxfd_model model;
    46		u32 freq;
    47		int ret;
    48	
    49		/* Check whether valid IRQ line is defined or not */
    50		if (spi->irq <= 0) {
    51			dev_err(&spi->dev, "no valid irq line defined: irq = %i\n",
    52				spi->irq);
    53			return -EINVAL;
    54		}
    55	
    56		priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
    57		if (!priv)
    58			return -ENOMEM;
    59	
    60		spi_set_drvdata(spi, priv);
    61		priv->spi = spi;
    62	
    63		/* Assign device name */
    64		snprintf(priv->device_name, sizeof(priv->device_name),
    65			 DEVICE_NAME "-%s", dev_name(&priv->spi->dev));
    66	
    67		/* assign model from of or driver_data */
    68		if (of_id)
  > 69			model = (enum mcp25xxfd_model)of_id->data;
    70		else
    71			model = spi_get_device_id(spi)->driver_data;
    72	
    73		clk = devm_clk_get(&spi->dev, NULL);
    74		if (IS_ERR(clk)) {
    75			ret = PTR_ERR(clk);
    76			goto out_free;
    77		}
    78	
    79		freq = clk_get_rate(clk);
    80		if (!(freq == CLOCK_4_MHZ || freq == CLOCK_10_MHZ ||
    81		      freq == CLOCK_40_MHZ)) {
    82			ret = -ERANGE;
    83			goto out_free;
    84		}
    85	
    86		ret = clk_prepare_enable(clk);
    87		if (ret)
    88			goto out_free;
    89	
    90		priv->clk = clk;
    91		priv->clock_freq = freq;
    92	
    93		/* Configure the SPI bus */
    94		spi->bits_per_word = 8;
    95	
    96		/* The frequency of SCK has to be less than or equal to half the
    97		 * frequency of SYSCLK.
    98		 */
    99		spi->max_speed_hz = freq / 2;
   100		ret = spi_setup(spi);
   101		if (ret)
   102			goto out_clk;
   103	
   104		priv->power = devm_regulator_get(&spi->dev, "vdd");
   105		if (IS_ERR(priv->power)) {
   106			if (PTR_ERR(priv->power) != -EPROBE_DEFER)
   107				dev_err(&spi->dev, "failed to get vdd\n");
   108			ret = PTR_ERR(priv->power);
   109			goto out_clk;
   110		}
   111	
   112		ret = mcp25xxfd_base_power_enable(priv->power, 1);
   113		if (ret)
   114			goto out_clk;
   115	
   116		/* disable interrupts */
   117		ret = mcp25xxfd_int_enable(priv, false);
   118		if (ret)
   119			goto out_power;
   120	
   121		/* setup ECC for SRAM */
   122		ret = mcp25xxfd_ecc_enable(priv);
   123		if (ret)
   124			goto out_power;
   125	
   126		dev_info(&spi->dev,
   127			 "MCP%04x successfully initialized.\n", model);
   128		return 0;
   129	
   130	out_power:
   131		mcp25xxfd_base_power_enable(priv->power, 0);
   132	out_clk:
   133		clk_disable_unprepare(clk);
   134	out_free:
   135		dev_err(&spi->dev, "Probe failed, err=%d\n", -ret);
   136		return ret;
   137	}
   138	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux