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

Re: [Xen-devel] [PATCH] arm/gic: Make sense of assertions



Hi,

On 10/15/19 11:01 AM, Andrii Anisov wrote:
From: Andrii Anisov <andrii_anisov@xxxxxxxx>

ARM Compiler complains about assertion conditions being always true,
because sgi is of enum type what has all its values under 16.
In order to preserve those asserts, specify the available SGI number
right in the enum and use it for the assertions. This also eliminates
nasty hardcoded values.

To be honest, those ASSERTIONs are pointless. If we are really worry of enum gic_sgi to have more than 16 values, then it would be best to use a BUILD_BUG_ON(). So you can get a build failure if that's every happening.

Something like:

static void __init __maybe_unused build_assertions(void)
{
      BUILD_BUG_ON(GIC_SGI_MAX > NR_GIC_SGI);
}

enum
{
     /* Use for sanity check on the size of the enum */
     GIC_MAX_SGI;
}

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.