Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d4e6af8 authored by Robert Elliott's avatar Robert Elliott Committed by James Bottomley
Browse files

hpsa: report allocation failures while allocating SG chain blocks



Reviewed-by: default avatarScott Teel <scott.teel@pmcs.com>
Signed-off-by: default avatarRobert Elliott <elliott@hp.com>
Signed-off-by: default avatarDon Brace <don.brace@pmcs.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 1eaec8f3
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1480,14 +1480,18 @@ static int hpsa_allocate_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)
	if (!h->cmd_sg_list) {
		dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
		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])
		if (!h->cmd_sg_list[i]) {
			dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
			goto clean;
		}
	}
	return 0;

clean: