Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2035345rdb; Mon, 9 Oct 2023 10:19:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpFkUkdsYgp5cx05xXee8oMGsQCs+HuuYN6m+nZn+se9dnN1uuhVOwbmZDDAmMH9ULG6YV X-Received: by 2002:a05:6a21:3296:b0:140:d536:d428 with SMTP id yt22-20020a056a21329600b00140d536d428mr16769326pzb.51.1696871954537; Mon, 09 Oct 2023 10:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696871954; cv=none; d=google.com; s=arc-20160816; b=P3Np0B4FXsNwF358WO4EYcrpNQAd4VfjPBtYVKrjjkphnRlywrPzm83gDn2GWu3fw1 KITX9GbXQ57dI73Sn6dhr34amYvfpChGGzdh6SqdHcVjIIWWe+ZcBEesyqaniqLHij1+ EAB+cMReZCyn64qY1ked2xY8RMkv6wY7VIgwLAfkO1RXUqZSl0WHRIjo9mdM5wqn8YvL q2Qsa3dZj2pgiReHXCG+MGySwYf2nUNClyGynzEEn86gjsfYeM1SPslNRu4K6Kx2/N+i J16Eip5Xq3jcY2dB+q1OjKqw8ZeCp7eukEznkQzgS1RgewxjwW6+Xt7uh5oK0BD6qaQm EGNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=ZYsDyuLHhe+jjGyQkgh34WNXlJPcA2wIrKJwL6sse2g=; fh=cnPV0PW0QjPDuzvzAf7NEt+tzbN/K3BDvfSjJQqQUjQ=; b=zi4l7wZu4OoKviMAZtVhDcFSrHqj0VBdbTb1loHo6AsIkEFgkMEEVl2WlNIfeNlQBg hgNIrfkUZ9bb6Hx5iTPreRa0aDrtwNNFpe2Af27M5PDdvtxIlM2HoTr9pWebC/uof0Yu kfVmTHdHAauvljdSyrE+t4wgM8q4xG18X3QCyNEdDtnBTHN1PZGHgjxoEi7JnIslZwZE UFqoNvpMnkPTpgZdsg+E1OTdV2156GXtUThv17w/wsd1ad/tQwO6r3C+GgnrAcmfsalr GJxNQAvg6cGA+hCJcDY9MwhtpOvUgCbLJ3XwpwrL77w+P1tObI0/7TP+IWzfFgb0Ov9D Wy4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=djobItll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y9-20020a056a001c8900b0068fcb9a7349si7494332pfw.349.2023.10.09.10.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=djobItll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B7FBA801CA73; Mon, 9 Oct 2023 10:19:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377634AbjJIRTK (ORCPT + 99 others); Mon, 9 Oct 2023 13:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377587AbjJIRTI (ORCPT ); Mon, 9 Oct 2023 13:19:08 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5475B94; Mon, 9 Oct 2023 10:19:07 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27740ce6c76so2786041a91.0; Mon, 09 Oct 2023 10:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696871947; x=1697476747; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=ZYsDyuLHhe+jjGyQkgh34WNXlJPcA2wIrKJwL6sse2g=; b=djobItllvsdaWsPyMmBKs9iMLkVIhT3QNjxCHlA93mNyWwIvMKABKy5BcYyL7SRQvl 2pEUhwHe7Tx1eOt/IC/C0Ca+42SGoYOa8hma5Nn+TPZB7t9GtQzOnFVdI5IbxGQoZ2SR DwrniADAOfgfA7twc15fEo3yBtdHCWoHgE6JygNDW3bM0uACdLotjKZwR07MiTs0z2wE eqdQjyw6RNC6LJ5VZitDRs8NLFG+HK3cRHRx5h01Ob0vs1DKoYdbnpnOft2VwCt1UlqF NafRXrtoH0W12pkbK7xBh48XV0z2XF6S/soFQRB06Ieg0juSofN/N3284tHZyYQbwCL/ ldkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696871947; x=1697476747; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZYsDyuLHhe+jjGyQkgh34WNXlJPcA2wIrKJwL6sse2g=; b=eHKixegULPzIZ7C2SUH5/H41t7gqY1dXEXNkyzch1fe4sshTC5qf1bcCOOKPaJSlfj DDzTLSGTsQ6PKOn9ulnZ+e3WveJayt53oJXkqfWvRxzdZw5+0uZh1OBxbdWNFb9f6Fbm oXonynIORveeHDKDLglVvPptbcwRa1oJELC+7QUNk0ENjjw2BxSklAXTKmk97s1Fjjy5 yPv9Xb05W5DRem/CjbqMqCtOwser+/5l+tCMVWbPv5UuIsSkyy6fNQOIOy1EvcgEzaWn CX9POYBlcDuMoGmsMKi5vsIFglQgub/Vq1uXKhSFu1mheR2rrc2OYZxfXN4aW5ydpIv6 q9ag== X-Gm-Message-State: AOJu0YyOKQF4ieRuGwIksv+9VSfSkt3h2iNVj+SfoA+erSznMyjnpfdm Ww5KIRul3tQ7fFtvqbJ3HAn+3VkrzNI= X-Received: by 2002:a17:90a:d804:b0:273:efc0:33eb with SMTP id a4-20020a17090ad80400b00273efc033ebmr11720051pjv.14.1696871946579; Mon, 09 Oct 2023 10:19:06 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u12-20020a17090adb4c00b0027722832498sm10650839pjx.52.2023.10.09.10.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:19:05 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 9 Oct 2023 10:19:04 -0700 From: Guenter Roeck To: Max Kellermann Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/7] drivers/hwmon: add local variable for newly allocated attribute_group** Message-ID: References: <20231009165741.746184-1-max.kellermann@ionos.com> <20231009165741.746184-2-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009165741.746184-2-max.kellermann@ionos.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:19:13 -0700 (PDT) On Mon, Oct 09, 2023 at 06:57:35PM +0200, Max Kellermann wrote: > This allows the compiler to keep the pointer in a register and > prepares for making the struct field "const". > > Signed-off-by: Max Kellermann I have no idea what this is about, and I don't see how that would improve anything, but ... > --- > drivers/hwmon/hwmon.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c > index c7dd3f5b2bd5..e50ab229b27d 100644 > --- a/drivers/hwmon/hwmon.c > +++ b/drivers/hwmon/hwmon.c > @@ -783,6 +783,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, > hdev = &hwdev->dev; > > if (chip) { > + const struct attribute_group **new_groups; > struct attribute **attrs; > int ngroups = 2; /* terminating NULL plus &hwdev->groups */ > > @@ -790,8 +791,8 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, > for (i = 0; groups[i]; i++) > ngroups++; > > - hwdev->groups = kcalloc(ngroups, sizeof(*groups), GFP_KERNEL); > - if (!hwdev->groups) { > + hwdev->groups = new_groups = kcalloc(ngroups, sizeof(*new_groups), GFP_KERNEL); CHECK: multiple assignments should be avoided #101: FILE: drivers/hwmon/hwmon.c:794: + hwdev->groups = new_groups = kcalloc(ngroups, sizeof(*new_groups), GFP_KERNEL); either case, this change is not acceptable. Guenter