Commit 7e8a9486 authored by Amit Kushwaha's avatar Amit Kushwaha Committed by Martin K. Petersen

scsi: hpsa: remove memory allocate failure message

This patch cleanup warning reported by checkpatch.pl WARNING: Possible
unnecessary 'out of memory' message With no available memory, a warn on
message already gets printed by page alloc apis and modified goto use if
memory unallocated.
Signed-off-by: default avatarAmit Kushwaha <kushwaha.a@samsung.com>
Acked-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2c9bce5b
...@@ -1557,10 +1557,9 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h, ...@@ -1557,10 +1557,9 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h,
/* Device is not on the list, add it. */ /* Device is not on the list, add it. */
device = kmalloc(sizeof(*device), GFP_KERNEL); device = kmalloc(sizeof(*device), GFP_KERNEL);
if (!device) { if (!device)
dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
return; return;
}
memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr)); memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
spin_lock_irqsave(&h->offline_device_lock, flags); spin_lock_irqsave(&h->offline_device_lock, flags);
list_add_tail(&device->offline_list, &h->offline_device_list); list_add_tail(&device->offline_list, &h->offline_device_list);
...@@ -2142,17 +2141,15 @@ static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h) ...@@ -2142,17 +2141,15 @@ static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h)
h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds, h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
GFP_KERNEL); GFP_KERNEL);
if (!h->cmd_sg_list) { if (!h->cmd_sg_list)
dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
return -ENOMEM; return -ENOMEM;
}
for (i = 0; i < h->nr_cmds; i++) { for (i = 0; i < h->nr_cmds; i++) {
h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) * h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
h->chainsize, GFP_KERNEL); h->chainsize, GFP_KERNEL);
if (!h->cmd_sg_list[i]) { if (!h->cmd_sg_list[i])
dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
goto clean; goto clean;
}
} }
return 0; return 0;
...@@ -3454,11 +3451,8 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr, ...@@ -3454,11 +3451,8 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
struct bmic_sense_subsystem_info *ssi; struct bmic_sense_subsystem_info *ssi;
ssi = kzalloc(sizeof(*ssi), GFP_KERNEL); ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
if (ssi == NULL) { if (!ssi)
dev_warn(&h->pdev->dev,
"%s: out of memory\n", __func__);
return; return;
}
rc = hpsa_bmic_sense_subsystem_information(h, rc = hpsa_bmic_sense_subsystem_information(h,
scsi3addr, 0, ssi, sizeof(*ssi)); scsi3addr, 0, ssi, sizeof(*ssi));
...@@ -4335,8 +4329,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h) ...@@ -4335,8 +4329,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL); currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
if (!currentsd[i]) { if (!currentsd[i]) {
dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
__FILE__, __LINE__);
h->drv_req_rescan = 1; h->drv_req_rescan = 1;
goto out; goto out;
} }
...@@ -8597,14 +8589,12 @@ static int hpsa_luns_changed(struct ctlr_info *h) ...@@ -8597,14 +8589,12 @@ static int hpsa_luns_changed(struct ctlr_info *h)
*/ */
if (!h->lastlogicals) if (!h->lastlogicals)
goto out; return rc;
logdev = kzalloc(sizeof(*logdev), GFP_KERNEL); logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
if (!logdev) { if (!logdev)
dev_warn(&h->pdev->dev, return rc;
"Out of memory, can't track lun changes.\n");
goto out;
}
if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) { if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
dev_warn(&h->pdev->dev, dev_warn(&h->pdev->dev,
"report luns failed, can't track lun changes.\n"); "report luns failed, can't track lun changes.\n");
...@@ -8998,11 +8988,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) ...@@ -8998,11 +8988,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
return; return;
options = kzalloc(sizeof(*options), GFP_KERNEL); options = kzalloc(sizeof(*options), GFP_KERNEL);
if (!options) { if (!options)
dev_err(&h->pdev->dev,
"Error: failed to disable rld caching, during alloc.\n");
return; return;
}
c = cmd_alloc(h); c = cmd_alloc(h);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment