mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: sunhme: Return an error when we are out of slots
@ 2023-02-22 17:09 Sean Anderson
  2023-02-22 20:59 ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Anderson @ 2023-02-22 17:09 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-kernel, Rolf Eike Beer, Sean Anderson, kernel test robot,
	Dan Carpenter

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-22 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 17:09 [PATCH net] net: sunhme: Return an error when we are out of slots Sean Anderson
2023-02-22 20:59 ` Simon Horman
2023-02-22 21:07   ` Sean Anderson
2023-02-22 21:19     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®