Thread (50 messages) 50 messages, 7 authors, 2015-10-20

Re: [PATCH 04/25] scsi: hisi_sas: add scsi host registration

From: John Garry <hidden>
Date: 2015-10-13 09:21:40
Also in: linux-scsi, lkml

On 12/10/2015 16:21, Arnd Bergmann wrote:
On Monday 12 October 2015 23:20:16 John Garry wrote:
quoted
+
+       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.
Will address.
quoted
+       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.
In a later patch we set as follows:
phy_nr = port_nr = hisi_hba->n_phy;

You did say in our earlier private review that we could add statically 
to hba strcut, but I commented that other vendors do similar so I would 
wait for more input.
	Arnd

.
Thanks,
John
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help