From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4734BCA9EB5 for ; Mon, 4 Nov 2019 17:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15D9D2080F for ; Mon, 4 Nov 2019 17:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729233AbfKDRH6 (ORCPT ); Mon, 4 Nov 2019 12:07:58 -0500 Received: from smtprelay0237.hostedemail.com ([216.40.44.237]:56994 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727998AbfKDRH5 (ORCPT ); Mon, 4 Nov 2019 12:07:57 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 0B472100E7B4B; Mon, 4 Nov 2019 17:07:56 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: cry91_2806dcf70c55d X-Filterd-Recvd-Size: 2112 Received: from XPS-9350.home (unknown [47.151.135.224]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Mon, 4 Nov 2019 17:07:54 +0000 (UTC) Message-ID: <782ef430f9c92742e92d63f87a6e7716b38ea110.camel@perches.com> Subject: Re: [PATCH] staging: rts5208: rewrite macro with GNU extension __auto_type From: Joe Perches To: Greg KH , Jules Irenge Cc: outreachy-kernel@googlegroups.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Mon, 04 Nov 2019 09:07:44 -0800 In-Reply-To: <20191104165148.GA2293059@kroah.com> References: <20191104164400.9935-1-jbi.octave@gmail.com> <20191104165148.GA2293059@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-11-04 at 17:51 +0100, Greg KH wrote: > On Mon, Nov 04, 2019 at 04:44:00PM +0000, Jules Irenge wrote: > > Rewrite macro function with GNU extension __auto_type > > to remove issue detected by checkpatch tool. > > CHECK: MACRO argument reuse - possible side-effects? [] > > diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h [] > > @@ -386,23 +386,31 @@ struct zone_entry { > > > > /* SD card */ > > #define CHK_SD(sd_card) (((sd_card)->sd_type & 0xFF) == TYPE_SD) > > -#define CHK_SD_HS(sd_card) (CHK_SD(sd_card) && \ > > - ((sd_card)->sd_type & SD_HS)) [] > > +#define CHK_SD_HS(sd_card)\ > > + ({__auto_type _sd = sd_card; CHK_SD(_sd) && \ > > + (_sd->sd_type & SD_HS); }) [] > Ick, no. These are obviously pointers, which can not be "evaluated > twice" so this whole thing is just fine. > > checkpatch is just a "hint" that you might want to look at the code. > This stuff is just fine, look at how it is being used for proof of that. This would also be the first introduction and use of __auto_type in the kernel. That's not OK as __auto_type was first supported in gcc 4.9 and the kernel still compiles with gcc 4.6.