Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2021739rdb; Mon, 9 Oct 2023 09:58:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmA3k6L/f4qf9rAsQ7Qwuh8hr3Ni9vJrsOcg6YWcNQq5rQnK0xuoFO08k2+RnYUwkg2hv8 X-Received: by 2002:a17:902:ee42:b0:1bd:e258:a256 with SMTP id 2-20020a170902ee4200b001bde258a256mr15576897plo.32.1696870726911; Mon, 09 Oct 2023 09:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696870726; cv=none; d=google.com; s=arc-20160816; b=Y4MOkFvpGafWwBuqRAzRTyCwLCNZva474SH0BqhGR5Vrzemj2le9BfFgA/rudRR4mq brhzL1SgqZ+u/bHfFmA/g4T+GncOXqm7wZQc5rH+l+yks0AOSfCM15RXHZLxpN1ycl6F /i1jdyH7m0pINv3pGI+DGq5ogIM4Us7L4vYVFn6wgyVokBpMVyCYxSOVvq6C7Lppz/yP gu4fEjGfCXFAT25Xgl1bznbOUWtcIT/5NlQyga2aWS44tuyxVOV3dcxVbSAysGqYXqQ5 SKMa+/c2b5xdYO4n1kS4tnxTz640jD7jAMp2XI0bFmL0Xl/LZmuhs+bCdCFLlyDkmVpm IgDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F2D+qd1LEt3eJ/8XHGRVqxXgOIKNs9E3/VA/WHhSU4M=; fh=hOgk8rZnGsqZJe3BQ3HCHvWjKB4vvEK5IbYVCdCAYP4=; b=rS4C6zziLpbtHJUlOh7pc0Xyo10NP7PSMRtFR+dUpVVrAx7npL6T3BodrMe+Ap4bYv t/zMM/vXi1STM656PRfSq+Wl8COZu7jnsj+8nb6vckpOkTDpJd5PhRK911SVdVyk4EaV Bt5ucoPy3PmJX1X+Kr1v6nzjB/lWntOxgzMOrlIKV1pUVlX8zbvbBxM5lzZmKPzKnP91 EF26OkGrPcDnCpEXL02coEJTMR4Te4dXNliCfTw88boqIKL6t7VfFRshSRSZi5lxQsjP gE8j7kVsvhAziou53zXw1tdJH7AptnOC3ibMbjjQiidLDsL4fu3x68XIKn/Dua/BkYPH YFAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MPD6ZLz3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id li11-20020a170903294b00b001c752577582si9408165plb.359.2023.10.09.09.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MPD6ZLz3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5334D80D7F73; Mon, 9 Oct 2023 09:58:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377830AbjJIQ6E (ORCPT + 99 others); Mon, 9 Oct 2023 12:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376910AbjJIQ54 (ORCPT ); Mon, 9 Oct 2023 12:57:56 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A321FA3 for ; Mon, 9 Oct 2023 09:57:54 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40675f06f1fso34270685e9.1 for ; Mon, 09 Oct 2023 09:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1696870673; x=1697475473; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F2D+qd1LEt3eJ/8XHGRVqxXgOIKNs9E3/VA/WHhSU4M=; b=MPD6ZLz3Oygw97Ahyj3zMbBaAvQcaeBhP4L0iVE53kYmz51MUTV7Z40oQDqXtj5PKX /YxCDgtUIoCEgUlOCwFDcZGzuBLalKfv4dyWpAVMJZXoNjjgk9/2/66L92j6R7Wtdnkn //uFE74D9h9n4/EbntkNepOWScQwhUcgxNLA5fBb3G8kSogc7z9KkXMAFq/LTR3EejoJ J4q0afWgH6VWW4GBiOkkiLZQcSKDer3mrri4QkeYhMDa4h3AVX3KGTQGnanAAq57cjlu vAE+7pNAI15CDWdLJrORbaEayWTDDtxKWzmXptNhwhasP8z238s4gcx37w1NHq7U6WYV RMsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696870673; x=1697475473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F2D+qd1LEt3eJ/8XHGRVqxXgOIKNs9E3/VA/WHhSU4M=; b=eqHWmU0CDTdPDYJc+WJBMHyYqHVjhYaIgvU+tREIep9DYVh64uerw7NLtNxgz5sKmZ J2KYUPzPyAxl1Ya9dYdBGGUHfaeAVS6RCvPooOJcS2p0UNonN365Mv7Iy9PecpUxs/DC yhSRNqSy3WExFpRX8utZnIHavrCKh7MSeoZl/X+RTxG6wu+q9ZMXNLTGj1GeYY/6T4XL kt8JraKEKEik2YGhAICvh3N3vkQSc2T6v1IN8KbSnEZn3AmW8FXkNhi8HJXw7bin0R2c fVRbXgJ7WYkdaDS0ppWRv1h4MGoUobalxIgURPZgaofBumpHj9KqSqDh1mojyR3/NHPk +1Hw== X-Gm-Message-State: AOJu0YwAIWqyc0m0DRnSK+9igc1BZLSmJUI8WbEL8kxG/DTZvQuBZOdq KQd/5RdNowWaX5YqEPO8kQyALA== X-Received: by 2002:a05:6000:1092:b0:320:968:f3b0 with SMTP id y18-20020a056000109200b003200968f3b0mr8718653wrw.35.1696870673079; Mon, 09 Oct 2023 09:57:53 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f49a600529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f49:a600:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id d9-20020adff2c9000000b00324887a13f7sm10199828wrp.0.2023.10.09.09.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:57:52 -0700 (PDT) From: Max Kellermann To: William Breathitt Gray Cc: Max Kellermann , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] drivers/counter: add local variable for newly allocated attribute_group** Date: Mon, 9 Oct 2023 18:57:37 +0200 Message-Id: <20231009165741.746184-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009165741.746184-1-max.kellermann@ionos.com> References: <20231009165741.746184-1-max.kellermann@ionos.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,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 morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 09:58:40 -0700 (PDT) X-Spam-Level: ** This allows the compiler to keep the pointer in a register and prepares for making the struct field "const". Signed-off-by: Max Kellermann --- drivers/counter/counter-sysfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/counter/counter-sysfs.c b/drivers/counter/counter-sysfs.c index 42c523343d32..47e1e2c61cf0 100644 --- a/drivers/counter/counter-sysfs.c +++ b/drivers/counter/counter-sysfs.c @@ -1122,6 +1122,7 @@ int counter_sysfs_add(struct counter_device *const counter) struct counter_attribute_group *cattr_groups; size_t i, j; int err; + const struct attribute_group **dev_groups; struct attribute_group *groups; struct counter_attribute *p; @@ -1141,9 +1142,9 @@ int counter_sysfs_add(struct counter_device *const counter) return err; /* Allocate attribute group pointers for association with device */ - dev->groups = devm_kcalloc(dev, num_groups + 1, sizeof(*dev->groups), + dev->groups = dev_groups = devm_kcalloc(dev, num_groups + 1, sizeof(*dev_groups), GFP_KERNEL); - if (!dev->groups) + if (!dev_groups) return -ENOMEM; /* Allocate space for attribute groups */ @@ -1169,7 +1170,7 @@ int counter_sysfs_add(struct counter_device *const counter) groups[i].attrs[j++] = &p->dev_attr.attr; /* Associate attribute group */ - dev->groups[i] = &groups[i]; + dev_groups[i] = &groups[i]; } return 0; -- 2.39.2