Messages in this thread Patch in this message | | | From | Sean Anderson <> | Subject | [PATCH net] net: sunhme: Return an error when we are out of slots | Date | Wed, 22 Feb 2023 12:09:35 -0500 |
| |
We only allocate enough space for four devices when the parent is a QFE. If we couldn't find a spot (because five devices were created for whatever reason), we would not return an error from probe(). Return ENODEV, which was what we did before.
Fixes: 96c6e9faecf1 ("sunhme: forward the error code from pci_enable_device()") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Sean Anderson <seanga2@gmail.com> ---
drivers/net/ethernet/sun/sunhme.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 1c16548415cd..523e26653ec8 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2861,12 +2861,13 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) if (!qp->happy_meals[qfe_slot]) - break; + goto found_slot; - if (qfe_slot == 4) - goto err_out; + err = -ENODEV; + goto err_out; } +found_slot: dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct happy_meal)); if (!dev) { err = -ENOMEM; -- 2.37.1
| |