diff options
author | Philip J Kelleher <pjk1939@linux.vnet.ibm.com> | 2013-03-26 12:03:07 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-03-26 16:48:11 -0400 |
commit | 4dcaf47258d59010802bd0eda933f69ee7d98cc7 (patch) | |
tree | b1787a3dcdd4a1ce5d59d0ba0ccff811fc30f268 /drivers/block | |
parent | d8d595dfce7925627de78b9eecc8598a6ffda610 (diff) |
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.c | 19 | ||||
-rw-r--r-- | drivers/block/rsxx/dma.c | 6 | ||||
-rw-r--r-- | drivers/block/rsxx/rsxx_priv.h | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 93f28191a0ff..5af21f2db29c 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) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static void rsxx_eeh_frozen(struct pci_dev *dev) | 326 | static int rsxx_eeh_frozen(struct pci_dev *dev) |
327 | { | 327 | { |
328 | struct rsxx_cardinfo *card = pci_get_drvdata(dev); | 328 | struct rsxx_cardinfo *card = pci_get_drvdata(dev); |
329 | int i; | 329 | int i; |
330 | int st; | ||
330 | 331 | ||
331 | dev_warn(&dev->dev, "IBM FlashSystem PCI: preparing for slot reset.\n"); | 332 | dev_warn(&dev->dev, "IBM FlashSystem PCI: preparing for slot reset.\n"); |
332 | 333 | ||
@@ -342,7 +343,9 @@ static void rsxx_eeh_frozen(struct pci_dev *dev) | |||
342 | 343 | ||
343 | pci_disable_device(dev); | 344 | pci_disable_device(dev); |
344 | 345 | ||
345 | rsxx_eeh_save_issued_dmas(card); | 346 | st = rsxx_eeh_save_issued_dmas(card); |
347 | if (st) | ||
348 | return st; | ||
346 | 349 | ||
347 | rsxx_eeh_save_issued_creg(card); | 350 | rsxx_eeh_save_issued_creg(card); |
348 | 351 | ||
@@ -356,6 +359,8 @@ static void rsxx_eeh_frozen(struct pci_dev *dev) | |||
356 | card->ctrl[i].cmd.buf, | 359 | card->ctrl[i].cmd.buf, |
357 | card->ctrl[i].cmd.dma_addr); | 360 | card->ctrl[i].cmd.dma_addr); |
358 | } | 361 | } |
362 | |||
363 | return 0; | ||
359 | } | 364 | } |
360 | 365 | ||
361 | static void rsxx_eeh_failure(struct pci_dev *dev) | 366 | static void rsxx_eeh_failure(struct pci_dev *dev) |
@@ -399,6 +404,8 @@ static int rsxx_eeh_fifo_flush_poll(struct rsxx_cardinfo *card) | |||
399 | static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev, | 404 | static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev, |
400 | enum pci_channel_state error) | 405 | enum pci_channel_state error) |
401 | { | 406 | { |
407 | int st; | ||
408 | |||
402 | if (dev->revision < RSXX_EEH_SUPPORT) | 409 | if (dev->revision < RSXX_EEH_SUPPORT) |
403 | return PCI_ERS_RESULT_NONE; | 410 | return PCI_ERS_RESULT_NONE; |
404 | 411 | ||
@@ -407,7 +414,13 @@ static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev, | |||
407 | return PCI_ERS_RESULT_DISCONNECT; | 414 | return PCI_ERS_RESULT_DISCONNECT; |
408 | } | 415 | } |
409 | 416 | ||
410 | rsxx_eeh_frozen(dev); | 417 | st = rsxx_eeh_frozen(dev); |
418 | if (st) { | ||
419 | dev_err(&dev->dev, "Slot reset setup failed\n"); | ||
420 | rsxx_eeh_failure(dev); | ||
421 | return PCI_ERS_RESULT_DISCONNECT; | ||
422 | } | ||
423 | |||
411 | return PCI_ERS_RESULT_NEED_RESET; | 424 | return PCI_ERS_RESULT_NEED_RESET; |
412 | } | 425 | } |
413 | 426 | ||
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 95047e111a33..7594c6ddc181 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) | |||
980 | } | 980 | } |
981 | } | 981 | } |
982 | 982 | ||
983 | void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) | 983 | int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) |
984 | { | 984 | { |
985 | int i; | 985 | int i; |
986 | int j; | 986 | int j; |
@@ -990,6 +990,8 @@ void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) | |||
990 | 990 | ||
991 | issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets, | 991 | issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets, |
992 | GFP_KERNEL); | 992 | GFP_KERNEL); |
993 | if (!issued_dmas) | ||
994 | return -ENOMEM; | ||
993 | 995 | ||
994 | for (i = 0; i < card->n_targets; i++) { | 996 | for (i = 0; i < card->n_targets; i++) { |
995 | INIT_LIST_HEAD(&issued_dmas[i]); | 997 | INIT_LIST_HEAD(&issued_dmas[i]); |
@@ -1030,6 +1032,8 @@ void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) | |||
1030 | } | 1032 | } |
1031 | 1033 | ||
1032 | kfree(issued_dmas); | 1034 | kfree(issued_dmas); |
1035 | |||
1036 | return 0; | ||
1033 | } | 1037 | } |
1034 | 1038 | ||
1035 | void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card) | 1039 | 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 8a7ac87f1dc5..382e8bf5c03b 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, | |||
381 | rsxx_dma_cb cb, | 381 | rsxx_dma_cb cb, |
382 | void *cb_data); | 382 | void *cb_data); |
383 | int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl); | 383 | int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl); |
384 | void rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card); | 384 | int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card); |
385 | void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card); | 385 | void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card); |
386 | int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card); | 386 | int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card); |
387 | 387 | ||