Re: [PATCH] stmmac: Replace deprecated PCI functions

From: Philipp Stanner
Date: Thu Feb 13 2025 - 04:53:09 EST


On Thu, 2025-02-13 at 17:02 +0800, kernel test robot wrote:
> Hi Philipp,
>
> kernel test robot noticed the following build errors:

sorry about those explosions. Normally I always test build. I think I
accidentally used an old branch. Too many branches…

Will fix all that in v2.

P.

>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v6.14-rc2 next-20250213]
> [cannot apply to horms-ipvs/master]
> [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/Philipp-Stanner/stmmac-Replace-deprecated-PCI-functions/20250212-230254
> base:   linus/master
> patch link:   
> https://lore.kernel.org/r/20250212145831.101719-2-phasta%40kernel.org
> patch subject: [PATCH] stmmac: Replace deprecated PCI functions
> config: s390-allmodconfig
> (https://download.01.org/0day-ci/archive/20250213/202502131623.bMnlG9
> wy-lkp@xxxxxxxxx/config)
> compiler: clang version 19.1.3
> (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b25
> 4b6afab99)
> reproduce (this is a W=1 build):
> (https://download.01.org/0day-ci/archive/20250213/202502131623.bMnlG9
> wy-lkp@xxxxxxxxx/reproduce)
>
> 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>
> > Closes:
> > https://lore.kernel.org/oe-kbuild-all/202502131623.bMnlG9wy-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
>    In file included from
> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:13:
>    In file included from include/linux/pci.h:37:
>    In file included from include/linux/device.h:32:
>    In file included from include/linux/device/driver.h:21:
>    In file included from include/linux/module.h:19:
>    In file included from include/linux/elf.h:6:
>    In file included from arch/s390/include/asm/elf.h:181:
>    In file included from arch/s390/include/asm/mmu_context.h:11:
>    In file included from arch/s390/include/asm/pgalloc.h:18:
>    In file included from include/linux/mm.h:2224:
>    include/linux/vmstat.h:504:43: warning: arithmetic between
> different enumeration types ('enum zone_stat_item' and 'enum
> numa_stat_item') [-Wenum-enum-conversion]
>      504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      505 |                            item];
>          |                            ~~~~
>    include/linux/vmstat.h:511:43: warning: arithmetic between
> different enumeration types ('enum zone_stat_item' and 'enum
> numa_stat_item') [-Wenum-enum-conversion]
>      511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      512 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/vmstat.h:524:43: warning: arithmetic between
> different enumeration types ('enum zone_stat_item' and 'enum
> numa_stat_item') [-Wenum-enum-conversion]
>      524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      525 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
> > > drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:197:28: error:
> > > expected ';' after return statement
>      197 |                         return PTR_ERR(res.addr)
>          |                                                 ^
>          |                                                 ;
>    3 warnings and 1 error generated.
>
>
> vim +197 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
>
>    140
>    141 /**
>    142 * stmmac_pci_probe
>    143 *
>    144 * @pdev: pci device pointer
>    145 * @id: pointer to table of device id/id's.
>    146 *
>    147 * Description: This probing function gets called for all
> PCI devices which
>    148 * match the ID table and are not "owned" by other driver
> yet. This function
>    149 * gets passed a "struct pci_dev *" for each device whose
> entry in the ID table
>    150 * matches the device. The probe functions returns zero when
> the driver choose
>    151 * to take "ownership" of the device or an error code(-ve
> no) otherwise.
>    152 */
>    153 static int stmmac_pci_probe(struct pci_dev *pdev,
>    154     const struct pci_device_id *id)
>    155 {
>    156 struct stmmac_pci_info *info = (struct
> stmmac_pci_info *)id->driver_data;
>    157 struct plat_stmmacenet_data *plat;
>    158 struct stmmac_resources res = {};
>    159 int i;
>    160 int ret;
>    161
>    162 plat = devm_kzalloc(&pdev->dev, sizeof(*plat),
> GFP_KERNEL);
>    163 if (!plat)
>    164 return -ENOMEM;
>    165
>    166 plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
>    167    sizeof(*plat-
> >mdio_bus_data),
>    168    GFP_KERNEL);
>    169 if (!plat->mdio_bus_data)
>    170 return -ENOMEM;
>    171
>    172 plat->dma_cfg = devm_kzalloc(&pdev->dev,
> sizeof(*plat->dma_cfg),
>    173      GFP_KERNEL);
>    174 if (!plat->dma_cfg)
>    175 return -ENOMEM;
>    176
>    177 plat->safety_feat_cfg = devm_kzalloc(&pdev->dev,
>    178      sizeof(*plat-
> >safety_feat_cfg),
>    179      GFP_KERNEL);
>    180 if (!plat->safety_feat_cfg)
>    181 return -ENOMEM;
>    182
>    183 /* Enable pci device */
>    184 ret = pcim_enable_device(pdev);
>    185 if (ret) {
>    186 dev_err(&pdev->dev, "%s: ERROR: failed to
> enable device\n",
>    187 __func__);
>    188 return ret;
>    189 }
>    190
>    191 /* The first BAR > 0 is the base IO addr of our
> device. */
>    192 for (i = 0; i < PCI_STD_NUM_BARS; i++) {
>    193 if (pci_resource_len(pdev, i) == 0)
>    194 continue;
>    195 res.addr = pcim_iomap_region(pdev, i,
> STMMAC_RESOURCE_NAME);
>    196 if (IS_ERR(res.addr))
>  > 197 return PTR_ERR(res.addr)
>    198 break;
>    199 }
>    200
>    201 pci_set_master(pdev);
>    202
>    203 ret = info->setup(pdev, plat);
>    204 if (ret)
>    205 return ret;
>    206
>    207 res.wol_irq = pdev->irq;
>    208 res.irq = pdev->irq;
>    209
>    210 plat->safety_feat_cfg->tsoee = 1;
>    211 plat->safety_feat_cfg->mrxpee = 1;
>    212 plat->safety_feat_cfg->mestee = 1;
>    213 plat->safety_feat_cfg->mrxee = 1;
>    214 plat->safety_feat_cfg->mtxee = 1;
>    215 plat->safety_feat_cfg->epsi = 1;
>    216 plat->safety_feat_cfg->edpp = 1;
>    217 plat->safety_feat_cfg->prtyen = 1;
>    218 plat->safety_feat_cfg->tmouten = 1;
>    219
>    220 return stmmac_dvr_probe(&pdev->dev, plat, &res);
>    221 }
>    222
>