net: axienet: move use of resource after validity check
We were accessing the pointer returned from platform_get_resource before checking if it was valid, causing an oops if it was not. Move this access after the call to devm_ioremap_resource which does the validity check. Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>alistair/sunxi64-5.4-dsi
parent
f9a94f85e8
commit
7fa0043d5c
|
@ -1679,13 +1679,13 @@ static int axienet_probe(struct platform_device *pdev)
|
|||
lp->tx_bd_num = TX_BD_NUM_DEFAULT;
|
||||
/* Map device registers */
|
||||
ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
lp->regs_start = ethres->start;
|
||||
lp->regs = devm_ioremap_resource(&pdev->dev, ethres);
|
||||
if (IS_ERR(lp->regs)) {
|
||||
dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n");
|
||||
ret = PTR_ERR(lp->regs);
|
||||
goto free_netdev;
|
||||
}
|
||||
lp->regs_start = ethres->start;
|
||||
|
||||
/* Setup checksum offload, but default to off if not specified */
|
||||
lp->features = 0;
|
||||
|
|
Loading…
Reference in New Issue