summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorPhilip J Kelleher <pjk1939@linux.vnet.ibm.com>2013-03-26 11:03:07 -0500
committerJens Axboe <axboe@kernel.dk>2013-03-26 14:48:11 -0600
commit4dcaf47258d59010802bd0eda933f69ee7d98cc7 (patch)
treeb1787a3dcdd4a1ce5d59d0ba0ccff811fc30f268 /drivers/block
parentd8d595dfce7925627de78b9eecc8598a6ffda610 (diff)
downloadop-kernel-dev-4dcaf47258d59010802bd0eda933f69ee7d98cc7.zip
op-kernel-dev-4dcaf47258d59010802bd0eda933f69ee7d98cc7.tar.gz
rsxx: enable error return of rsxx_eeh_save_issued_dmas()
Commit d8d595df introduced a bug where we did not check for a NULL return from kmalloc(). Make rsxx_eeh_save_issued_dmas() return an error for that case, and make the callers handle that. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rsxx/core.c19
-rw-r--r--drivers/block/rsxx/dma.c6
-rw-r--r--drivers/block/rsxx/rsxx_priv.h2
3 files changed, 22 insertions, 5 deletions
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 93f2819..5af21f2 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -323,10 +323,11 @@ static int card_shutdown(struct rsxx_cardinfo *card)
return 0;
}
-static void rsxx_eeh_frozen(struct pci_dev *dev)
+static int rsxx_eeh_frozen(struct pci_dev *dev)
{
struct rsxx_cardinfo *card = pci_get_drvdata(dev);
int i;
+ int st;
dev_warn(&dev->dev, "IBM FlashSystem PCI: preparing for slot reset.\n");
@@ -342,7 +343,9 @@ static void rsxx_eeh_frozen(struct pci_dev *dev)
pci_disable_device(dev);
- rsxx_eeh_save_issued_dmas(card);
+ st = rsxx_eeh_save_issued_dmas(card);
+ if (st)
+ return st;
rsxx_eeh_save_issued_creg(card);
@@ -356,6 +359,8 @@ static void rsxx_eeh_frozen(struct pci_dev *dev)
card->ctrl[i].cmd.buf,
card->ctrl[i].cmd.dma_addr);
}
+
+ return 0;
}
static void rsxx_eeh_failure(struct pci_dev *dev)
@@ -399,6 +404,8 @@ static int rsxx_eeh_fifo_flush_poll(struct rsxx_cardinfo *card)
static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev,
enum pci_channel_state error)
{
+ int st;
+
if (dev->revision < RSXX_EEH_SUPPORT)
return PCI_ERS_RESULT_NONE;
@@ -407,7 +414,13 @@ static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev,
return PCI_ERS_RESULT_DISCONNECT;
}
- rsxx_eeh_frozen(dev);
+ st = rsxx_eeh_frozen(dev);
+ if (st) {
+ dev_err(&dev->dev, "Slot reset setup failed\n");
+ rsxx_eeh_failure(dev);
+ return PCI_ERS_RESULT_DISCONNECT;
+ }
+
return PCI_ERS_RESULT_NEED_RESET;
}
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c
index 95047e1..7594c6d 100644
--- a/drivers/block/rsxx/dma.c
+++ b/drivers/block/rsxx/dma.c
@@ -980,7 +980,7 @@ void rsxx_dma_destroy(struct rsxx_cardinfo *card)
}
}
-void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
+int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
{
int i;
int j;
@@ -990,6 +990,8 @@ void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets,
GFP_KERNEL);
+ if (!issued_dmas)
+ return -ENOMEM;
for (i = 0; i < card->n_targets; i++) {
INIT_LIST_HEAD(&issued_dmas[i]);
@@ -1030,6 +1032,8 @@ void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
}
kfree(issued_dmas);
+
+ return 0;
}
void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card)
diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h
index 8a7ac87..382e8bf 100644
--- a/drivers/block/rsxx/rsxx_priv.h
+++ b/drivers/block/rsxx/rsxx_priv.h
@@ -381,7 +381,7 @@ int rsxx_dma_queue_bio(struct rsxx_cardinfo *card,
rsxx_dma_cb cb,
void *cb_data);
int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl);
-void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card);
+int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card);
void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card);
int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card);
OpenPOWER on IntegriCloud