Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

r8169: use dev_err_probe in all appropriate places in rtl_init_one()

In addition to properly handling probe deferrals dev_err_probe()
conveniently combines printing an error message with returning
the errno. So let's use it for every error path in rtl_init_one()
to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/f0596a19-d517-e301-b649-304f9247b75a@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
733b3e27 b345b2a6

+15 -25
+15 -25
drivers/net/ethernet/realtek/r8169_main.c
··· 5196 5196 5197 5197 /* enable device (incl. PCI PM wakeup and hotplug setup) */ 5198 5198 rc = pcim_enable_device(pdev); 5199 - if (rc < 0) { 5200 - dev_err(&pdev->dev, "enable failure\n"); 5201 - return rc; 5202 - } 5199 + if (rc < 0) 5200 + return dev_err_probe(&pdev->dev, rc, "enable failure\n"); 5203 5201 5204 5202 if (pcim_set_mwi(pdev) < 0) 5205 5203 dev_info(&pdev->dev, "Mem-Wr-Inval unavailable\n"); 5206 5204 5207 5205 /* use first MMIO region */ 5208 5206 region = ffs(pci_select_bars(pdev, IORESOURCE_MEM)) - 1; 5209 - if (region < 0) { 5210 - dev_err(&pdev->dev, "no MMIO resource found\n"); 5211 - return -ENODEV; 5212 - } 5207 + if (region < 0) 5208 + return dev_err_probe(&pdev->dev, -ENODEV, "no MMIO resource found\n"); 5213 5209 5214 5210 rc = pcim_iomap_regions(pdev, BIT(region), KBUILD_MODNAME); 5215 - if (rc < 0) { 5216 - dev_err(&pdev->dev, "cannot remap MMIO, aborting\n"); 5217 - return rc; 5218 - } 5211 + if (rc < 0) 5212 + return dev_err_probe(&pdev->dev, rc, "cannot remap MMIO, aborting\n"); 5219 5213 5220 5214 tp->mmio_addr = pcim_iomap_table(pdev)[region]; 5221 5215 5222 5216 txconfig = RTL_R32(tp, TxConfig); 5223 - if (txconfig == ~0U) { 5224 - dev_err(&pdev->dev, "PCI read failed\n"); 5225 - return -EIO; 5226 - } 5217 + if (txconfig == ~0U) 5218 + return dev_err_probe(&pdev->dev, -EIO, "PCI read failed\n"); 5227 5219 5228 5220 xid = (txconfig >> 20) & 0xfcf; 5229 5221 5230 5222 /* Identify chip attached to board */ 5231 5223 chipset = rtl8169_get_mac_version(xid, tp->supports_gmii); 5232 - if (chipset == RTL_GIGA_MAC_NONE) { 5233 - dev_err(&pdev->dev, "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n", xid); 5234 - return -ENODEV; 5235 - } 5236 - 5224 + if (chipset == RTL_GIGA_MAC_NONE) 5225 + return dev_err_probe(&pdev->dev, -ENODEV, 5226 + "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n", 5227 + xid); 5237 5228 tp->mac_version = chipset; 5238 5229 5239 5230 tp->dash_type = rtl_check_dash(tp); ··· 5244 5253 rtl_hw_reset(tp); 5245 5254 5246 5255 rc = rtl_alloc_irq(tp); 5247 - if (rc < 0) { 5248 - dev_err(&pdev->dev, "Can't allocate interrupt\n"); 5249 - return rc; 5250 - } 5256 + if (rc < 0) 5257 + return dev_err_probe(&pdev->dev, rc, "Can't allocate interrupt\n"); 5258 + 5251 5259 tp->irq = pci_irq_vector(pdev, 0); 5252 5260 5253 5261 INIT_WORK(&tp->wk.work, rtl_task);