Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2504595rwb; Mon, 3 Oct 2022 01:30:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gtqt0DWxeovVFkc80Hqwlf2JTykuDrh4sI20PPhvwDsTx8Uyb+4YfZxj7KpnRxpuoF+Gx X-Received: by 2002:a62:4c2:0:b0:52e:bd4d:50e1 with SMTP id 185-20020a6204c2000000b0052ebd4d50e1mr22114936pfe.8.1664785812162; Mon, 03 Oct 2022 01:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785812; cv=none; d=google.com; s=arc-20160816; b=b1r5YbgHnfryFvBzqDp8PrBD6lGcQuItREs2At3hrvsDVwKhH3XQVfXubgI/u6Cd4B 2FZ9nM0tPpPp2Qw9tQi4N27LWLODoKxr6JFvcKZZlpDAdvrXUz0srmkgym4swLKptgT7 OM6wNiPR06tMD8fZ9bSkGzbY4XTfeuvfNwBbQEXt6kj2O5JoVAlaHHyOFP/Y2QgisBj2 c1wuIBPm/s1bNq1gtrkxffAfZi7WyN+fiMM6KzIxtV5bCnVSSJMdJuQ5qYF/Cghz8jVo flthi88DmVuPKicHkkt6VF2kPMp9xdYT61lPiWfjfEkweSNzljmIDOiaGHtjyTWpAqU/ BXww== 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=yQVEXtjVundTYGl5ak6Tt/Vu9+/Jd3evig4WZXjO+sQ=; b=TtyC11Uykz055Dvj988KaRO8crUi293OIbtYNrnH0PoIndZ/EwxQa8tyf0Rm8IASsh ZZ2RwLK8HZWSA8UyOl+w8+3CSoMNexOYU5NES7yIOGFtGpRwTngqECodiqQPie+u1wyP l86drUjSpSV+VkShRjNUlKolNPjqUaCQhcEk/qy+98ZOzaDuJyIWb/uSoI63BaeEcwlX RhI2iN6UwFE0lGNt+KQLyeDVaF305bZ0f3y5lrEY2TL6gH1R8VcDOW3/Bvl0SVWGizOn 7G8X+nrSPxzKyLxeglLAtD5lE3GiTa3BBUggSn4gqg90iARLAaXJ5mzO2ZFyn2iaTz42 5HFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WBDnC7Gm; 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 s16-20020a170902989000b001783d4945b9si8902423plp.602.2022.10.03.01.29.59; Mon, 03 Oct 2022 01:30:12 -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=WBDnC7Gm; 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 S230226AbiJCITA (ORCPT + 99 others); Mon, 3 Oct 2022 04:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbiJCISg (ORCPT ); Mon, 3 Oct 2022 04:18:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCB5E1C124; Mon, 3 Oct 2022 00:53:42 -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 7192560F9B; Mon, 3 Oct 2022 07:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76DABC433B5; Mon, 3 Oct 2022 07:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781504; bh=tb0bQpnUQ+TPZ2/ugxZ8lhm5RCQjTZugfa0mWmPiO8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBDnC7Gm3CI0fZRMFZPsjR1iy1+LibFTnwx4k4mM6iRhbmt3PwkWQ5SBtD+z5gGDk BHjTFUWMDo1FcPg7rFf88BSQ+apeUR5Ok0nCumh/0I3nSVA9l1Fxp+aINXUqucrC4K 3kZ05PtXAzshqNDVdxhK3zagycTwIeaD26yzw7cA= 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.15 45/83] soc: sunxi: sram: Fix probe function ordering issues Date: Mon, 3 Oct 2022 09:11:10 +0200 Message-Id: <20221003070723.122239167@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@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 a858a37fcdd4..52d07bed7664 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -332,9 +332,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; @@ -346,13 +346,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->num_emac_clocks > 0) { emac_clock = devm_regmap_init_mmio(&pdev->dev, base, &sunxi_sram_emac_clock_regmap); @@ -361,6 +354,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