Commit e6a54d6f authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

qed: Don't ignore devlink allocation failures

devlink is a software interface that doesn't depend on any hardware
capabilities. The failure in SW means memory issues, wrong parameters,
programmer error e.t.c.

Like any other such interface in the kernel, the returned status of
devlink APIs should be checked and propagated further and not ignored.

Fixes: 755f982b ("qed/qede: make devlink survive recovery")
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2ff04286
...@@ -1176,19 +1176,17 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, ...@@ -1176,19 +1176,17 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
edev->devlink = qed_ops->common->devlink_register(cdev); edev->devlink = qed_ops->common->devlink_register(cdev);
if (IS_ERR(edev->devlink)) { if (IS_ERR(edev->devlink)) {
DP_NOTICE(edev, "Cannot register devlink\n"); DP_NOTICE(edev, "Cannot register devlink\n");
rc = PTR_ERR(edev->devlink);
edev->devlink = NULL; edev->devlink = NULL;
/* Go on, we can live without devlink */ goto err3;
} }
} else { } else {
struct net_device *ndev = pci_get_drvdata(pdev); struct net_device *ndev = pci_get_drvdata(pdev);
struct qed_devlink *qdl;
edev = netdev_priv(ndev); edev = netdev_priv(ndev);
qdl = devlink_priv(edev->devlink);
if (edev->devlink) {
struct qed_devlink *qdl = devlink_priv(edev->devlink);
qdl->cdev = cdev; qdl->cdev = cdev;
}
edev->cdev = cdev; edev->cdev = cdev;
memset(&edev->stats, 0, sizeof(edev->stats)); memset(&edev->stats, 0, sizeof(edev->stats));
memcpy(&edev->dev_info, &dev_info, sizeof(dev_info)); memcpy(&edev->dev_info, &dev_info, sizeof(dev_info));
......
...@@ -3416,7 +3416,9 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) ...@@ -3416,7 +3416,9 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
qedf->devlink = qed_ops->common->devlink_register(qedf->cdev); qedf->devlink = qed_ops->common->devlink_register(qedf->cdev);
if (IS_ERR(qedf->devlink)) { if (IS_ERR(qedf->devlink)) {
QEDF_ERR(&qedf->dbg_ctx, "Cannot register devlink\n"); QEDF_ERR(&qedf->dbg_ctx, "Cannot register devlink\n");
rc = PTR_ERR(qedf->devlink);
qedf->devlink = NULL; qedf->devlink = NULL;
goto err2;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment