Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535598 > unrolled thread

[PATCH 1/1] scsi: fnic: fix improper return value

Started byPan Bian <bianpan201604@163.com>
First post2016-12-04 07:00 +0100
Last post2016-12-04 07:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] scsi: fnic: fix improper return value Pan Bian <bianpan201604@163.com> - 2016-12-04 07:00 +0100

#1535598 — [PATCH 1/1] scsi: fnic: fix improper return value

FromPan Bian <bianpan201604@163.com>
Date2016-12-04 07:00 +0100
Subject[PATCH 1/1] scsi: fnic: fix improper return value
Message-ID<sKy09-3c6-3@gated-at.bofh.it>
From: Pan Bian <bianpan2016@163.com>

When the calls to mempool_create_slab_pool() return unexpected values,
the value of return variable err is 0. 0 means no error. Thus, the
caller of fnic_probe() cannot detect the error, and may be misled. This
patch fixes the bug, assigning "-ENOMEM" to err before calling
mempool_create_slab_pool().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189051

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/scsi/fnic/fnic_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 58ce902..389c13e 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -735,6 +735,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	for (i = 0; i < FNIC_IO_LOCKS; i++)
 		spin_lock_init(&fnic->io_req_lock[i]);
 
+	err = -ENOMEM;
 	fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
 	if (!fnic->io_req_pool)
 		goto err_out_free_resources;
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web