Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2502386rwb; Mon, 3 Oct 2022 01:27:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6F/U/Ue3mFI+ciOSmHHvPJDDH9iCvoDN+eHG8kArRgHfwwZUcHeGXKc/eV7EMpTvByQyUV X-Received: by 2002:a63:4542:0:b0:43c:b1c6:7df8 with SMTP id u2-20020a634542000000b0043cb1c67df8mr18187577pgk.138.1664785638033; Mon, 03 Oct 2022 01:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785638; cv=none; d=google.com; s=arc-20160816; b=BgQ0sMyD9JIZeq2/L06BcURMrcb7Erzh6DMdRk+lMH4/Bdiq8V3y6JyXrzJrmH8yQu +8ow/7P2rXAOcCWVXjKCL2mthfYxPDmcFw5qN/KA5CwaMJnBw1zq5qQH8+PuPGMPvmk1 260YNbFkEkIMGL1KPLo6e6CvJEv5CCcgwoFfOueJuqOu0RZXTqr9FY8tjmNYeL50yKXB JfCalFCaSJ8ZzjSjboTxWxZexDNyCi2FhOcDi69pg/n+djKTyCpN1L49yjttc9rU/xKs Ns4GMLwm+CWIdemAuR+DLSwziG7hqu832AqX5mpngmR4g/4v3YamHbztCUGsYk5mxm0v y4Mg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/hCsXj8vZP06Lsxc99t+IFarxyPMg/dmVxYXarK/RCs=; b=Hx8FoUpalGP2nZa8ZxnrOwxgxO2LAuQ2Yizy1vYUazFzmA8Fz2OzTUky9hLASuix5I lKAtUle8yoK6Bp4uYMUnusvo2eq4+9r3Pffp41YPVpTRf81FGcw063iUsQ++28gENQs6 cGpiLieoARJfofY/ls9tPkq12P/5GA9jhhTd4XY55Kpfp9s2I+xl8Jcw4VjDwwTnwInh v+UjNk9uj7oNA1KiXHg0gK1QCTA7wiKQvlsF1IbLjISndTxxB7rwhHhSOSR/TvGMdKvO IZduqXi1HyweaRd//+u5AKHHB+rX7VeR65wGTZUlt8To/80xGcQfSAtLEf8IWPzpIdiH QXtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1pD8NYF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng8-20020a17090b1a8800b001fac80ecd20si8068675pjb.61.2022.10.03.01.27.06; Mon, 03 Oct 2022 01:27:18 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1pD8NYF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbiJCH4p (ORCPT + 99 others); Mon, 3 Oct 2022 03:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiJCHz6 (ORCPT ); Mon, 3 Oct 2022 03:55:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB85A5140A; Mon, 3 Oct 2022 00:33:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8127560FAB; Mon, 3 Oct 2022 07:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 942FDC433C1; Mon, 3 Oct 2022 07:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781776; bh=pkiKzZqM6+JbgCqQ2ob2gtDePEoLK5AGKIv58CA9PUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1pD8NYFuprBAI0o9yjzkZ/YoxXBKO5uUTg9L9IeNHaawWZMCLTbnDoSO7I08HiZk tw7A1+4WTK1dTWEYF3/vbKq4fPqcKObYQDy72NysaIeT6fUgr8e01El3DtypJTLwV6 3zemOxONyNqeum8w1nZ0aKmLyBGYCEGDf9azCSX0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.10 36/52] soc: sunxi: sram: Fix probe function ordering issues Date: Mon, 3 Oct 2022 09:11:43 +0200 Message-Id: <20221003070719.812591046@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070718.687440096@linuxfoundation.org> References: <20221003070718.687440096@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Samuel Holland [ Upstream commit 49fad91a7b8941979c3e9a35f9894ac45bc5d3d6 ] Errors from debugfs are intended to be non-fatal, and should not prevent the driver from probing. Since debugfs file creation is treated as infallible, move it below the parts of the probe function that can fail. This prevents an error elsewhere in the probe function from causing the file to leak. Do the same for the call to of_platform_populate(). Finally, checkpatch suggests an octal literal for the file permissions. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs") Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-6-samuel@sholland.org Signed-off-by: Sasha Levin --- drivers/soc/sunxi/sunxi_sram.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index ba05727b2614..ef1620ea4bdb 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -321,9 +321,9 @@ static struct regmap_config sunxi_sram_emac_clock_regmap = { static int __init sunxi_sram_probe(struct platform_device *pdev) { - struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; + struct device *dev = &pdev->dev; sram_dev = &pdev->dev; @@ -335,13 +335,6 @@ static int __init sunxi_sram_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); - - d = debugfs_create_file("sram", S_IRUGO, NULL, NULL, - &sunxi_sram_fops); - if (!d) - return -ENOMEM; - if (variant->has_emac_clock) { emac_clock = devm_regmap_init_mmio(&pdev->dev, base, &sunxi_sram_emac_clock_regmap); @@ -350,6 +343,10 @@ static int __init sunxi_sram_probe(struct platform_device *pdev) return PTR_ERR(emac_clock); } + of_platform_populate(dev->of_node, NULL, NULL, dev); + + debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); + return 0; } -- 2.35.1