Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

On Wed, 21 Jan 2015 21:40:15 +0100 Peter Huewe <peterhuewe@xxxxxx> wrote:
>
> This fixes a build failure if CONFIG_PNP is set but CONFIG_ACPI is not:
> drivers/char/tpm/tpm_tis.c: In function ‘tpm_tis_pnp_init’:
> drivers/char/tpm/tpm_tis.c:912:45: error: invalid type argument of
> ‘->’ (have ‘int’)
>    acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
> 
> If CONFIG_PNPACPI is not set pnp_acpi_device is defined as 0 and thus
> accesing the handle is not possible.
> 
> Fixes: 0dc553652102 ("tpm: fix raciness of PPI interface lookup")
> Reported-by: Jim Davis <jim.epost@xxxxxxxxx>
> Signed-off-by: Peter Huewe <peterhuewe@xxxxxx>
> ---
>  drivers/char/tpm/tpm_tis.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 20a61bc98db8..6725bef7cb96 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -908,8 +908,10 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
>  	if (is_itpm(pnp_dev))
>  		itpm = true;
>  
> +#ifdef CONFIG_ACPI
>  	if (pnp_acpi_device(pnp_dev))
>  		acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
> +#endif
>  
>  	return tpm_tis_init(&pnp_dev->dev, acpi_dev_handle, start, len, irq);
>  }

To save on the ifdef, why not

	struct acpi_device *acpi;

	.
	.

	acpi = pnp_acpi_device(dev);
	if (acpi)
		acpi_dev_handle = acpi->handle;

As an aside, the dummy pnp_acpi_device() should be returning NULL not
0, and could be a static inline function (as could several other things
in that header.
-- 
Cheers,
Stephen Rothwell                    sfr@xxxxxxxxxxxxxxxx

Attachment: pgpX2PKulJM3B.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux