[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5053179.dHmgEztyeB@wuerfel>
Date: Mon, 12 Oct 2015 17:21:34 +0200
From: Arnd Bergmann <arnd@...db.de>
To: John Garry <john.garry@...wei.com>
Cc: James.Bottomley@...senpartnership.com,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linuxarm@...wei.com, zhangfei.gao@...aro.org,
linux-scsi@...r.kernel.org, xuwei5@...ilicon.com,
john.garry2@...l.dcu.ie, hare@...e.de
Subject: Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration
On Monday 12 October 2015 23:20:16 John Garry wrote:
> +
> + shost = scsi_host_alloc(&hisi_sas_sht, sizeof(void *));
> + if (!shost)
> + return -ENOMEM;
> +
> + hisi_hba = hisi_sas_hba_alloc(pdev, shost, np);
> + if (!hisi_hba) {
> + rc = -ENOMEM;
> + goto err_out_ha;
> + }
You can collapse the allocations into one and just pass sizeof(*hisi_hba)
instead of sizeof(void *) above.
> + sha = SHOST_TO_SAS_HA(shost) = &hisi_hba->sha;
> + platform_set_drvdata(pdev, sha);
> +
> + phy_nr = port_nr = HISI_SAS_MAX_PHYS;
> +
> + arr_phy = devm_kcalloc(dev, phy_nr, sizeof(void *), GFP_KERNEL);
> + arr_port = devm_kcalloc(dev, port_nr, sizeof(void *), GFP_KERNEL);
> + if (!arr_phy || !arr_port)
> + return -ENOMEM;
And since these are fixed-size arrays, they can be moved in there as well.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists