Skip to content

Commit 7e8a948

Browse files
Amit Kushwahamartinkpetersen
authored andcommitted
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: Amit Kushwaha <[email protected]> Acked-by: Don Brace <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2c9bce5 commit 7e8a948

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

drivers/scsi/hpsa.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,10 +1557,9 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h,
15571557

15581558
/* Device is not on the list, add it. */
15591559
device = kmalloc(sizeof(*device), GFP_KERNEL);
1560-
if (!device) {
1561-
dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
1560+
if (!device)
15621561
return;
1563-
}
1562+
15641563
memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
15651564
spin_lock_irqsave(&h->offline_device_lock, flags);
15661565
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)
21422141

21432142
h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
21442143
GFP_KERNEL);
2145-
if (!h->cmd_sg_list) {
2146-
dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
2144+
if (!h->cmd_sg_list)
21472145
return -ENOMEM;
2148-
}
2146+
21492147
for (i = 0; i < h->nr_cmds; i++) {
21502148
h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
21512149
h->chainsize, GFP_KERNEL);
2152-
if (!h->cmd_sg_list[i]) {
2153-
dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
2150+
if (!h->cmd_sg_list[i])
21542151
goto clean;
2155-
}
2152+
21562153
}
21572154
return 0;
21582155

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

34563453
ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
3457-
if (ssi == NULL) {
3458-
dev_warn(&h->pdev->dev,
3459-
"%s: out of memory\n", __func__);
3454+
if (!ssi)
34603455
return;
3461-
}
34623456

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

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

85998591
if (!h->lastlogicals)
8600-
goto out;
8592+
return rc;
86018593

86028594
logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
8603-
if (!logdev) {
8604-
dev_warn(&h->pdev->dev,
8605-
"Out of memory, can't track lun changes.\n");
8606-
goto out;
8607-
}
8595+
if (!logdev)
8596+
return rc;
8597+
86088598
if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
86098599
dev_warn(&h->pdev->dev,
86108600
"report luns failed, can't track lun changes.\n");
@@ -8998,11 +8988,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
89988988
return;
89998989

90008990
options = kzalloc(sizeof(*options), GFP_KERNEL);
9001-
if (!options) {
9002-
dev_err(&h->pdev->dev,
9003-
"Error: failed to disable rld caching, during alloc.\n");
8991+
if (!options)
90048992
return;
9005-
}
90068993

90078994
c = cmd_alloc(h);
90088995

0 commit comments

Comments
 (0)