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

Re: [PATCH 7/7] xen/device_tree: Fix MISRA C 2012 Rule 20.7 violations


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 Aug 2022 11:59:59 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KCSLAks50XrcWc6++GVzg7BuGcHKd0HodZbHpcQBZG4=; b=Rs9X3f4Q7Hc80XBnlvsqU9CcwoHns4UZrkaUxXyuVn4On89WKYjT1OQqcq0n/ZNwieiu4LWPLnxkJ1R/GJ6W3TF5U3Lh2irIsauioSD4YgfJ1hnHvpG9R3XCWKnMjxERVMJhZT6kYqC16zleWathsZEQD95qVxV/G0RjW5AKX/6KUp/uMMjWDPRT4iy8O/s0iDnt0izBAK7Uvs32Fb0qq9XRoJPq9tqi8ZTshZRX7BZmCyLtUbLNvgBJBEeHBTNUFLJC4MCHwPO2q+93erocMpH5mnNHXP4zfgCZzL038C6ALQQPsfgLCrmqF2LhhT6SVQV2HYi6LuNcVLoGc1Ricg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bkFTIO2vdAnqxCRwqGZUI/VGrmGRZGq1+iYX7P8Ds17iHQml823RP7aGrYPU1MDb66I5CiD8mjHBysJdPbRBPfuf6M0qfCxYeCyMKYSBk4OeD2dD39C22fL7+7Q1lSXgrHSM2giC+qG+/2Ky25bYynnGEDFu0sqVbrNoFHbud22pxLuKuGwHAYFr5EqPT28rIAJk2kg6edK7qYrImGuSPJfSC2+sGs97vunHfjBdEdc4U5x/O6oUc9WaIEYfd5dhAmkKtACW36NkGx96h7/4WNiOVhoq47geFE8hQafE5reF3jzC+RdtJ17umL3AwshsHr7KTKR/yQML/aNbKdsLcg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 22 Aug 2022 10:00:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.08.2022 21:43, Xenia Ragiadakou wrote:
> In macros dt_for_each_property_node(), dt_for_each_device_node() and
> dt_for_each_child_node(), add parentheses around the macro parameters that
> have the arrow operator applied, to prevent against unintended expansions.

Why is this relevant only when -> is used? For comparisons and the rhs of
assignments it's as relevant, ad even for the lhs of assignments I doubt
it can be generally omitted.

> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -222,13 +222,13 @@ dt_find_interrupt_controller(const struct 
> dt_device_match *matches);
>  #define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1
>  
>  #define dt_for_each_property_node(dn, pp)                   \
> -    for ( pp = dn->properties; pp != NULL; pp = pp->next )
> +    for ( pp = (dn)->properties; pp != NULL; pp = (pp)->next )
>  
>  #define dt_for_each_device_node(dt, dn)                     \
> -    for ( dn = dt; dn != NULL; dn = dn->allnext )
> +    for ( dn = dt; dn != NULL; dn = (dn)->allnext )
>  
>  #define dt_for_each_child_node(dt, dn)                      \
> -    for ( dn = dt->child; dn != NULL; dn = dn->sibling )
> +    for ( dn = (dt)->child; dn != NULL; dn = (dn)->sibling )
>  
>  /* Helper to read a big number; size is in cells (not bytes) */
>  static inline u64 dt_read_number(const __be32 *cell, int size)




 


Rackspace

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