Re: [PATCH v2 07/22] scsi: hisi_sas: create hisi_sas_get_fw_info()

From: Arnd Bergmann
Date: Mon May 29 2017 - 06:53:35 EST


On Thu, May 25, 2017 at 2:04 PM, John Garry <john.garry@xxxxxxxxxx> wrote:
> Move the functionality to retrieve the fw info into
> a dedicated device type-agnostic function,
> hisi_sas_get_fw_info().
>
> The reasoning is that this function will be required
> for future pci-based platforms.
>

> -
> if (device_property_read_u8_array(dev, "sas-addr", hisi_hba->sas_addr,
> - SAS_ADDR_SIZE))
> - goto err_out;
> + SAS_ADDR_SIZE)) {
> + dev_err(dev, "could not get property sas-addr\n");
> + return -ENOENT;
> + }
>
> if (np) {
> hisi_hba->ctrl = syscon_regmap_lookup_by_phandle(np,
> "hisilicon,sas-syscon");
> - if (IS_ERR(hisi_hba->ctrl))
> - goto err_out;
> + if (IS_ERR(hisi_hba->ctrl)) {
> + dev_err(dev, "could not get syscon\n");
> + return -ENOENT;
> + }

If I read this right, it will fail to work for a PCI-based driver trying to read
"sas-addr" but not the other properties that would now be hardcoded from
the PCI ID.

Maybe you just need

- if (np) {
+ if (np && is_platform_device) {

Arnd