From: Dan Carpenter <error27@gmail.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] isicomm: handle running out of slots
Date: Fri, 7 May 2010 10:30:41 +0200 [thread overview]
Message-ID: <20100507083041.GU27064@bicker> (raw)
This patch makes it return -ENODEV if we run out of empty slots in the
probe function. It's unlikely to happen, but it makes the static
checkers happy.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 0fa2e4a..5f24bdb 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1568,11 +1568,16 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
/* allot the first empty slot in the array */
- for (index = 0; index < BOARD_COUNT; index++)
+ for (index = 0; index < BOARD_COUNT; index++) {
if (isi_card[index].base == 0) {
board = &isi_card[index];
break;
}
+ }
+ if (index == BOARD_COUNT) {
+ retval = -ENODEV;
+ goto err_disable;
+ }
board->index = index;
board->base = pci_resource_start(pdev, 3);
@@ -1619,6 +1624,7 @@ errunrr:
errdec:
board->base = 0;
card_count--;
+err_disable:
pci_disable_device(pdev);
err:
return retval;
reply other threads:[~2010-05-07 8:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100507083041.GU27064@bicker \
--to=error27@gmail.com \
--cc=alan@linux.intel.com \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox