Re: [PATCH 3/3] checks: Ensure '#interrupt-cells' only exists in interrupt providers

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



On Tue, Sep 28, 2021 at 04:23:35PM -0500, Rob Herring wrote:
> The interrupt provider check currently checks if an interrupt provider
> has #interrupt-cells, but not whether #interrupt-cells is present
> outside of interrupt-providers. Rework the check to cover the latter
> case.
> 
> Cc: Andre Przywara <andre.przywara@xxxxxxx>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>

Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>


> ---
>  checks.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/checks.c b/checks.c
> index 2efa36377e80..7f769e92ef71 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -1573,14 +1573,20 @@ static void check_interrupt_provider(struct check *c,
>  				     struct node *node)
>  {
>  	struct property *prop;
> +	bool irq_provider = node_is_interrupt_provider(node);
>  
> -	if (!node_is_interrupt_provider(node))
> +	prop = get_property(node, "#interrupt-cells");
> +	if (irq_provider && !prop) {
> +		FAIL(c, dti, node,
> +		     "Missing '#interrupt-cells' in interrupt-controller");
>  		return;
> +	}
>  
> -	prop = get_property(node, "#interrupt-cells");
> -	if (!prop)
> +	if (!irq_provider && prop) {
>  		FAIL(c, dti, node,
> -		     "Missing #interrupt-cells in interrupt provider");
> +		     "'#interrupt-cells' found, but node is not an interrupt provider");
> +		return;
> +	}
>  }
>  WARNING(interrupt_provider, check_interrupt_provider, NULL);
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux