Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3489202pxb; Mon, 4 Apr 2022 18:37:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjcbSMJN9mBpfHzLJvOeAZ27pegNAPfbbbWHN91ZQy9SllSzJPJuJp6haXM66z/45c1Ln2 X-Received: by 2002:a05:6a00:1812:b0:4fe:2233:a61e with SMTP id y18-20020a056a00181200b004fe2233a61emr943190pfa.49.1649122646716; Mon, 04 Apr 2022 18:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649122646; cv=none; d=google.com; s=arc-20160816; b=kkMCnuEP35M0z6MQjaJX0avTJg5T93D19hdVCsvaHzjUzCxM2DLnho4Du8tAtbBX0/ 3jrN2ecHr2RD6MJUNlGNojcnbK6rhr/Hf/RzGlApdm06Gq+bLR1Pz2cTwNFNOVvsvNjb s5nGEBRoa+4yDdYPWvrzzcTZF0vb5ph5F089XC6ZAiGioq7GjuzZiyFQtSFj6Lhao2aN ov4qf7wmnm+cYyXhn6XQS3mws+TN/pCE1l7gJUss+vqrJTYof1wn1K07AOtZw1TCSGG6 rAbLL7p8eiCA4Sy9I6NUR4oO5Sqy4Lb+W7wXdoq/I8JZ6ju8Wy/e1XzcaDoHqvwo8LdO GsZw== 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=6OyNeZS+QG1hA8GYAjcgVvsD0Y3gZ/R3mypb4i3MxqE=; b=boOGEzyldagnLjEWwaLrgQO6AWgctjbOJS6XyTt57kiP+1nWG8pxqLgtRyltSoe21d 9LlqHsdXWaxEt+VYuMyb8RP9soqgyfTBhfCO3/jfVLdIBzvBw8btrAlWw4+BUNlO5n1k 7g3DA+nrlgmteFu5rc5OmWo9S6bAyLwGY+UwYeEnVmJrUICuUJm37uR2a67CiHQZzG6A w5nForZhKuLO4MZmzJgmHqms7aRYr62Ss6CiRW4kOqIAjMA/8f1XmopV7MUcE0gs0OCS NYw4oUxPnzIfExOpiFsYGjIkN4njrWKtktfWtWUX3YFj9fpCIgGGm02AauofwHCfbS4u 6UeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=dqX6rxz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bd14-20020a656e0e000000b003991e150e5fsi4912454pgb.798.2022.04.04.18.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=dqX6rxz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2E194EF73; Mon, 4 Apr 2022 17:30:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236380AbiDDJ7m (ORCPT + 99 others); Mon, 4 Apr 2022 05:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355033AbiDDJ7X (ORCPT ); Mon, 4 Apr 2022 05:59:23 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609CD3BFBE for ; Mon, 4 Apr 2022 02:57:27 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 2D7E32224E; Mon, 4 Apr 2022 11:57:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1649066245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6OyNeZS+QG1hA8GYAjcgVvsD0Y3gZ/R3mypb4i3MxqE=; b=dqX6rxz52L2kLkfD4q33e9A2jU23arfKYKfLcnfS1KnKRue1l/FWG9godj347kUe702IaX +eWNQPL2ChnQqET8pteLa1Q3WJtesB1oteA4SpwhzrM8zsXv0369buTj+LRlga3DVGSasC zcdL/4aNgMi3sL6UBTKUZCG3BDcrbSc= From: Michael Walle To: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Shawn Guo , Li Yang , Ulf Hansson , Sudeep Holla , Arnd Bergmann , Dan Carpenter , Michael Walle Subject: [PATCH RESEND v2 4/7] soc: fsl: guts: allocate soc_dev_attr on the heap Date: Mon, 4 Apr 2022 11:56:06 +0200 Message-Id: <20220404095609.3932782-5-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220404095609.3932782-1-michael@walle.cc> References: <20220404095609.3932782-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 This is the last global static variable. Drop it and allocate the memory on the heap instead. Signed-off-by: Michael Walle Acked-by: Arnd Bergmann --- drivers/soc/fsl/guts.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 4e5675ab5f73..44e7a9bf6392 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -20,9 +20,6 @@ struct fsl_soc_die_attr { u32 mask; }; -static struct soc_device_attribute soc_dev_attr; - - /* SoC die attribute definition for QorIQ platform */ static const struct fsl_soc_die_attr fsl_soc_die[] = { /* @@ -116,6 +113,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match( static int fsl_guts_probe(struct platform_device *pdev) { struct device_node *root, *np = pdev->dev.of_node; + struct soc_device_attribute *soc_dev_attr; static struct soc_device *soc_dev; struct device *dev = &pdev->dev; const struct fsl_soc_die_attr *soc_die; @@ -136,12 +134,16 @@ static int fsl_guts_probe(struct platform_device *pdev) iounmap(regs); /* Register soc device */ + soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) + return -ENOMEM; + root = of_find_node_by_path("/"); if (of_property_read_string(root, "model", &machine)) of_property_read_string_index(root, "compatible", 0, &machine); if (machine) { - soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL); - if (!soc_dev_attr.machine) { + soc_dev_attr->machine = devm_kstrdup(dev, machine, GFP_KERNEL); + if (!soc_dev_attr->machine) { of_node_put(root); return -ENOMEM; } @@ -150,30 +152,30 @@ static int fsl_guts_probe(struct platform_device *pdev) soc_die = fsl_soc_die_match(svr, fsl_soc_die); if (soc_die) { - soc_dev_attr.family = devm_kasprintf(dev, GFP_KERNEL, - "QorIQ %s", soc_die->die); + soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL, + "QorIQ %s", soc_die->die); } else { - soc_dev_attr.family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ"); + soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ"); } - if (!soc_dev_attr.family) + if (!soc_dev_attr->family) return -ENOMEM; - soc_dev_attr.soc_id = devm_kasprintf(dev, GFP_KERNEL, - "svr:0x%08x", svr); - if (!soc_dev_attr.soc_id) + soc_dev_attr->soc_id = devm_kasprintf(dev, GFP_KERNEL, + "svr:0x%08x", svr); + if (!soc_dev_attr->soc_id) return -ENOMEM; - soc_dev_attr.revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d", - (svr >> 4) & 0xf, svr & 0xf); - if (!soc_dev_attr.revision) + soc_dev_attr->revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d", + (svr >> 4) & 0xf, svr & 0xf); + if (!soc_dev_attr->revision) return -ENOMEM; - soc_dev = soc_device_register(&soc_dev_attr); + soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) return PTR_ERR(soc_dev); - pr_info("Machine: %s\n", soc_dev_attr.machine); - pr_info("SoC family: %s\n", soc_dev_attr.family); + pr_info("Machine: %s\n", soc_dev_attr->machine); + pr_info("SoC family: %s\n", soc_dev_attr->family); pr_info("SoC ID: %s, Revision: %s\n", - soc_dev_attr.soc_id, soc_dev_attr.revision); + soc_dev_attr->soc_id, soc_dev_attr->revision); return 0; } -- 2.30.2