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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 C2564C4363D for ; Wed, 7 Oct 2020 13:46:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 709432087D for ; Wed, 7 Oct 2020 13:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728503AbgJGNqQ (ORCPT ); Wed, 7 Oct 2020 09:46:16 -0400 Received: from verein.lst.de ([213.95.11.211]:37411 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbgJGNqQ (ORCPT ); Wed, 7 Oct 2020 09:46:16 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 574736736F; Wed, 7 Oct 2020 15:46:14 +0200 (CEST) Date: Wed, 7 Oct 2020 15:46:14 +0200 From: Christoph Hellwig To: Bartosz Golaszewski Cc: Joel Becker , Christoph Hellwig , linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 09/12] samples: configfs: prefer sizeof(*var) to sizeof(struct var_type) Message-ID: <20201007134614.GC764@lst.de> References: <20200924124526.17365-1-brgl@bgdev.pl> <20200924124526.17365-10-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924124526.17365-10-brgl@bgdev.pl> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 02:45:23PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > It's better to use the size of the actual variable than its type when > allocating memory. This also has the benefit of avoiding a line break > here. Either style has up an downside. The variable based on tracks type changes automatically, but on the other hand leads to lots of bugs where people forget the *. I'd rather not just change from one to the other pointlessly.