Skip to content

Commit

Permalink
scsi: hpsa: remove memory allocate failure message
Browse files Browse the repository at this point in the history
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: Amit Kushwaha <kushwaha.a@samsung.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Amit Kushwaha authored and Martin K. Petersen committed Dec 14, 2016
1 parent 2c9bce5 commit 7e8a948
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions drivers/scsi/hpsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,10 +1557,9 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h,

/* Device is not on the list, add it. */
device = kmalloc(sizeof(*device), GFP_KERNEL);
if (!device) {
dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
if (!device)
return;
}

memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
spin_lock_irqsave(&h->offline_device_lock, flags);
list_add_tail(&device->offline_list, &h->offline_device_list);
Expand Down Expand Up @@ -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,
GFP_KERNEL);
if (!h->cmd_sg_list) {
dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
if (!h->cmd_sg_list)
return -ENOMEM;
}

for (i = 0; i < h->nr_cmds; i++) {
h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
h->chainsize, GFP_KERNEL);
if (!h->cmd_sg_list[i]) {
dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
if (!h->cmd_sg_list[i])
goto clean;
}

}
return 0;

Expand Down Expand Up @@ -3454,11 +3451,8 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
struct bmic_sense_subsystem_info *ssi;

ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
if (ssi == NULL) {
dev_warn(&h->pdev->dev,
"%s: out of memory\n", __func__);
if (!ssi)
return;
}

rc = hpsa_bmic_sense_subsystem_information(h,
scsi3addr, 0, ssi, sizeof(*ssi));
Expand Down Expand Up @@ -4335,8 +4329,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)

currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
if (!currentsd[i]) {
dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
__FILE__, __LINE__);
h->drv_req_rescan = 1;
goto out;
}
Expand Down Expand Up @@ -8597,14 +8589,12 @@ static int hpsa_luns_changed(struct ctlr_info *h)
*/

if (!h->lastlogicals)
goto out;
return rc;

logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
if (!logdev) {
dev_warn(&h->pdev->dev,
"Out of memory, can't track lun changes.\n");
goto out;
}
if (!logdev)
return rc;

if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
dev_warn(&h->pdev->dev,
"report luns failed, can't track lun changes.\n");
Expand Down Expand Up @@ -8998,11 +8988,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
return;

options = kzalloc(sizeof(*options), GFP_KERNEL);
if (!options) {
dev_err(&h->pdev->dev,
"Error: failed to disable rld caching, during alloc.\n");
if (!options)
return;
}

c = cmd_alloc(h);

Expand Down

0 comments on commit 7e8a948

Please sign in to comment.