Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2843576imw; Sun, 17 Jul 2022 18:44:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sa0j8RfC/d1Gipq2Xvjrfb4uPzip4S9G6626mzFZSshZtd9tmBVxesAbgTGWM6UUR0EdUx X-Received: by 2002:a17:902:e746:b0:16c:3ffd:61fb with SMTP id p6-20020a170902e74600b0016c3ffd61fbmr25962012plf.123.1658108647081; Sun, 17 Jul 2022 18:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658108647; cv=none; d=google.com; s=arc-20160816; b=nBNrX4tV9/5e0Mqny60Mx2FrgX5GfBuA/jTYLhVQt51cj1GkDFk2PJAHz5ssdvlwPR uEuZyHXAEPcIPQ2gfMhyqXicStrilvEePq3/f8dJA3n8IHtrWVTZ1+AvT5NZDoG+rQ7R a/M/KzlYgzlaldqnTGENwDbqwCSVxX13c3vr3/WGZWUtcBtLpnSEb1If6Fs2NKWYFzLb 7d9zksJxZROIxv8T8sCcSCoF92Z6dFX0L6eTa2qIPewYH22quwCgEbY0OEGbWi19ZhPe Dd7whi9ogOOWJBOuw7PZzU687zfzOB4lC1yslkfa7FasBNxjiZfVpJhxYaXl1HC5t29S qghQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=wnLvB38HhoSuLVgl2ojZH3VYDELikl7vLUMIiXwZMKE=; b=Xi7goFOUonvChh4Gd77o5T/nDlt5rnqVhUvjgdlTgIAkS8LTJXew73J8Tm3iI4xE4b q2rIuRBTbZHbnkC2S4RTU/GkcpLZxqJS7+JNJXnRy0XFvGh+mUm8TPDCYET0noG4Hnep +3BYnB0SCOuIxYvTLQM4ujFoEp3ZRVRrkqBJGlsmcViZXG6cbGf92mCBk/N+nn41pXNC r1H2orNPLkw+8c6GoIPDWHpUDI2SxJej4ONHt5aYc+4HWvHxI3tQDYQjpNZ98E79LtaZ dkFBrOs8IIQJTn6MxRCpr61w5opn4AWveWkjJO4vXte42LfoEnHg4T3f/3ipq8Ul0eyl ip1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj12-20020a17090b4f4c00b001ef7e9d9b41si19608959pjb.115.2022.07.17.18.43.53; Sun, 17 Jul 2022 18:44:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233037AbiGRBZi convert rfc822-to-8bit (ORCPT + 99 others); Sun, 17 Jul 2022 21:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiGRBZh (ORCPT ); Sun, 17 Jul 2022 21:25:37 -0400 Received: from relay5.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB5412D1E for ; Sun, 17 Jul 2022 18:25:34 -0700 (PDT) Received: from omf17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6145734AF2; Mon, 18 Jul 2022 01:25:33 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA id 4F9451B; Mon, 18 Jul 2022 01:25:32 +0000 (UTC) Message-ID: <75022a03a4d0c8b238dcf1c7b60b5d222b184f34.camel@perches.com> Subject: Re: [PATCH] iio: Use parens with sizeof From: Joe Perches To: Joe Simmons-Talbott Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 17 Jul 2022 18:25:31 -0700 In-Reply-To: References: <20220717153438.10800-1-joetalbott@gmail.com> <59c0003bfc5b429a8e39151da942fcaf707109a0.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.1-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Stat-Signature: 1gw8a1ssdy3q8eymts5jdr64ozfj9jxw X-Rspamd-Server: rspamout01 X-Rspamd-Queue-Id: 4F9451B X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/KRbjCFivTyg9MUXbeneQDW+99K+w5z4A= X-HE-Tag: 1658107532-148806 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2022-07-17 at 16:08 -0400, Joe Simmons-Talbott wrote: > On Sun, Jul 17, 2022 at 10:08:37AM -0700, Joe Perches wrote: > > On Sun, 2022-07-17 at 11:34 -0400, Joe Simmons-Talbott wrote: > > > Prefer 'sizeof(var)' over 'sizeof var' as reported by checkpatch.pl. > > > > unrelated trivia: > > > > > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c > > [] > > > @@ -368,7 +368,7 @@ struct iio_poll_func > > > va_list vargs; > > > struct iio_poll_func *pf; > > > > > > - pf = kmalloc(sizeof *pf, GFP_KERNEL); > > > + pf = kmalloc(sizeof(*pf), GFP_KERNEL); > > > if (pf == NULL) > > > return NULL; > > > va_start(vargs, fmt); > > > @@ -560,7 +560,7 @@ struct iio_trigger *viio_trigger_alloc(struct device *parent, > > > struct iio_trigger *trig; > > > int i; > > > > > > - trig = kzalloc(sizeof *trig, GFP_KERNEL); > > > + trig = kzalloc(sizeof(*trig), GFP_KERNEL); > > > if (!trig) > > > return NULL; > > > > It'd be nice to be consistent with the allocation return test. > > > > Please pick one of: > > > > if (ptr == NULL) > > or > > if (!ptr) // my preference > > > > I'm happy to submit a patch for that. Do you want me to include a > Suggested-by: tag? Not really.