Re: [PATCH] net: modernize ioremap in probe
From: Dan Carpenter
Date: Mon Nov 11 2024 - 04:40:44 EST
Hi Rosen,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-modernize-ioremap-in-probe/20241110-073751
base: net-next/main
patch link: https://lore.kernel.org/r/20241109233641.8313-1-rosenp%40gmail.com
patch subject: [PATCH] net: modernize ioremap in probe
config: arm-randconfig-r071-20241110 (https://download.01.org/0day-ci/archive/20241111/202411110835.tTxOya6U-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202411110835.tTxOya6U-lkp@xxxxxxxxx/
smatch warnings:
drivers/net/ethernet/freescale/xgmac_mdio.c:395 xgmac_mdio_probe() error: uninitialized symbol 'res'.
vim +/res +395 drivers/net/ethernet/freescale/xgmac_mdio.c
33897cc869eef8 Bill Pemberton 2012-12-03 371 static int xgmac_mdio_probe(struct platform_device *pdev)
9f35a7342cff0b Timur Tabi 2012-08-20 372 {
ac53c26433b51f Marcin Wojtas 2021-06-25 373 struct fwnode_handle *fwnode;
73ee5442978b2d Shaohui Xie 2015-03-16 374 struct mdio_fsl_priv *priv;
15e7064e879335 Calvin Johnson 2021-06-11 375 struct resource *res;
15e7064e879335 Calvin Johnson 2021-06-11 376 struct mii_bus *bus;
9f35a7342cff0b Timur Tabi 2012-08-20 377 int ret;
9f35a7342cff0b Timur Tabi 2012-08-20 378
229f4bb47512ec Calvin Johnson 2020-06-22 379 /* In DPAA-1, MDIO is one of the many FMan sub-devices. The FMan
229f4bb47512ec Calvin Johnson 2020-06-22 380 * defines a register space that spans a large area, covering all the
229f4bb47512ec Calvin Johnson 2020-06-22 381 * subdevice areas. Therefore, MDIO cannot claim exclusive access to
229f4bb47512ec Calvin Johnson 2020-06-22 382 * this register area.
229f4bb47512ec Calvin Johnson 2020-06-22 383 */
9f35a7342cff0b Timur Tabi 2012-08-20 384
1d14eb15dc2c39 Tobias Waldekranz 2022-01-26 385 bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(struct mdio_fsl_priv));
9f35a7342cff0b Timur Tabi 2012-08-20 386 if (!bus)
9f35a7342cff0b Timur Tabi 2012-08-20 387 return -ENOMEM;
9f35a7342cff0b Timur Tabi 2012-08-20 388
9f35a7342cff0b Timur Tabi 2012-08-20 389 bus->name = "Freescale XGMAC MDIO Bus";
c0fc8e6dcee40c Andrew Lunn 2023-01-09 390 bus->read = xgmac_mdio_read_c22;
c0fc8e6dcee40c Andrew Lunn 2023-01-09 391 bus->write = xgmac_mdio_write_c22;
c0fc8e6dcee40c Andrew Lunn 2023-01-09 392 bus->read_c45 = xgmac_mdio_read_c45;
c0fc8e6dcee40c Andrew Lunn 2023-01-09 393 bus->write_c45 = xgmac_mdio_write_c45;
9f35a7342cff0b Timur Tabi 2012-08-20 394 bus->parent = &pdev->dev;
229f4bb47512ec Calvin Johnson 2020-06-22 @395 snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res->start);
^^^
res isn't initialized.
9f35a7342cff0b Timur Tabi 2012-08-20 396
73ee5442978b2d Shaohui Xie 2015-03-16 397 priv = bus->priv;
865bbb2945a161 Rosen Penev 2024-11-09 398 priv->mdio_base = devm_platform_ioremap_resource(pdev, 0);
865bbb2945a161 Rosen Penev 2024-11-09 399 if (IS_ERR(priv->mdio_base))
865bbb2945a161 Rosen Penev 2024-11-09 400 return PTR_ERR(priv->mdio_base);
9f35a7342cff0b Timur Tabi 2012-08-20 401
15e7064e879335 Calvin Johnson 2021-06-11 402 /* For both ACPI and DT cases, endianness of MDIO controller
15e7064e879335 Calvin Johnson 2021-06-11 403 * needs to be specified using "little-endian" property.
15e7064e879335 Calvin Johnson 2021-06-11 404 */
229f4bb47512ec Calvin Johnson 2020-06-22 405 priv->is_little_endian = device_property_read_bool(&pdev->dev,
07bf2e11ad0586 Julia Lawall 2016-08-05 406 "little-endian");
73ee5442978b2d Shaohui Xie 2015-03-16 407
6198c722019774 Tobias Waldekranz 2022-01-18 408 priv->has_a009885 = device_property_read_bool(&pdev->dev,
6198c722019774 Tobias Waldekranz 2022-01-18 409 "fsl,erratum-a009885");
229f4bb47512ec Calvin Johnson 2020-06-22 410 priv->has_a011043 = device_property_read_bool(&pdev->dev,
1d3ca681b9d957 Madalin Bucur 2020-01-22 411 "fsl,erratum-a011043");
1d3ca681b9d957 Madalin Bucur 2020-01-22 412
909bea73485fab Tobias Waldekranz 2022-01-26 413 xgmac_mdio_set_suppress_preamble(bus);
909bea73485fab Tobias Waldekranz 2022-01-26 414
dd8f467eda72cd Tobias Waldekranz 2022-01-26 415 ret = xgmac_mdio_set_mdc_freq(bus);
dd8f467eda72cd Tobias Waldekranz 2022-01-26 416 if (ret)
dd8f467eda72cd Tobias Waldekranz 2022-01-26 417 return ret;
dd8f467eda72cd Tobias Waldekranz 2022-01-26 418
105b0468d7b2e6 zhaoxiao 2022-08-18 419 fwnode = dev_fwnode(&pdev->dev);
ac53c26433b51f Marcin Wojtas 2021-06-25 420 if (is_of_node(fwnode))
ac53c26433b51f Marcin Wojtas 2021-06-25 421 ret = of_mdiobus_register(bus, to_of_node(fwnode));
ac53c26433b51f Marcin Wojtas 2021-06-25 422 else if (is_acpi_node(fwnode))
ac53c26433b51f Marcin Wojtas 2021-06-25 423 ret = acpi_mdiobus_register(bus, fwnode);
ac53c26433b51f Marcin Wojtas 2021-06-25 424 else
ac53c26433b51f Marcin Wojtas 2021-06-25 425 ret = -EINVAL;
9f35a7342cff0b Timur Tabi 2012-08-20 426 if (ret) {
9f35a7342cff0b Timur Tabi 2012-08-20 427 dev_err(&pdev->dev, "cannot register MDIO bus\n");
9f35a7342cff0b Timur Tabi 2012-08-20 428 return ret;
9f35a7342cff0b Timur Tabi 2012-08-20 429 }
9f35a7342cff0b Timur Tabi 2012-08-20 430
1d14eb15dc2c39 Tobias Waldekranz 2022-01-26 431 platform_set_drvdata(pdev, bus);
9f35a7342cff0b Timur Tabi 2012-08-20 432
9f35a7342cff0b Timur Tabi 2012-08-20 433 return 0;
9f35a7342cff0b Timur Tabi 2012-08-20 434 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki