Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2555711rwb; Mon, 3 Oct 2022 02:29:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/sUtrexD3hUPZUXfEplys3Q9QSVgwhdafPBatcPmn9296BsRUVe9D65KFyg/ToP90ERlH X-Received: by 2002:a17:907:b15:b0:782:f8:8695 with SMTP id h21-20020a1709070b1500b0078200f88695mr14095563ejl.693.1664789382236; Mon, 03 Oct 2022 02:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664789382; cv=none; d=google.com; s=arc-20160816; b=K6EYaXId+fLK7F5unWRGJLbkMDFOC9NxCIYSZstwfz7gRbPeE3p9udFAZL3zlStNxR +5nuIfsSzlTPOFKP9GsYBQY9tJd+VD3QoKuAsoHKCuKZFWCkeSleZd96DOA7OMMwmsTu vC9bdsL1z+SGw4o25A6CWzuSkytZLPSHrpu0dh7qIzH/rNLkNJ/we5xxAba+y8pZD+8L vTs/6utLZDpwaz406mQvkU6P0mnz6DZ3A28zUw270FvyUt+Lxbn8EZ9/JHRlaV9hehLO j6ZjJtiyAUAlilt8ofY7aG2u6o4E4jJDteWnA/qbkKu0cutW88+QK4aBiNXUcg0uKkxn vYhQ== 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=erQeOhKEBk3nlWpmO0YpMidCylfEYeDHDySehCbu8mM=; b=W8JACd8rgKAsZdBpaHHMN2wybKXRy591P/pcKy/EB3UX0VXiEqk5G1DmpwAqhf0CsH j18nFoiH8Q+wmy6N2cmly9f/yGPRAP2wdRqzUjburoJBYFQenTI55ALowOhh06f/BBy5 6R81KbLcHs+L6t+Z89tzykRoSOhBZXQCvIkt40/qc+BwcnPQ8XNy3Cvvdn4yrqn7lw+U bqOorbecVmfdl9l7EqLj1cbptbAIb9m5G8NVLSlD/z3PTKNudq4iY7SLu7/cSch2ezQp XTl/PpGzVY/SqHKaFGMyBu7UtrWDnFyPAjRMi4mLeZ/lYlYvf51TCcyfqm1q4jegMbWy x1Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LRls+2ez; 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 h13-20020a0564020e0d00b00457015040fcsi7314456edh.315.2022.10.03.02.29.16; Mon, 03 Oct 2022 02:29:42 -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=LRls+2ez; 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 S232070AbiJCHo5 (ORCPT + 99 others); Mon, 3 Oct 2022 03:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbiJCHnp (ORCPT ); Mon, 3 Oct 2022 03:43:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8402980E; Mon, 3 Oct 2022 00:25:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id 38C19B80E9D; Mon, 3 Oct 2022 07:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87716C433C1; Mon, 3 Oct 2022 07:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781908; bh=bH8tmTDyX6oq9H2j2RQ6weiKAgLRb0hcdLrWON/XEuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRls+2ez4H1UDwosMEYnhFeyeogJ/akNGCgh6OfYG+f/t3rQs6xda0dLUJSzbzwY4 JKgt9/UVrVqQvOvpB10PcCgykob0u5HEfAtWOEvMMhK5lUnpsEBtLaMoeJeXnl2i9m AtINPggdhmyFOFlhsjbvDFF+3UdgK2zXi7BE/s0U= 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 4.19 17/25] soc: sunxi: sram: Fix probe function ordering issues Date: Mon, 3 Oct 2022 09:12:20 +0200 Message-Id: <20221003070715.921132977@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@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 17ac818622fe..98a4d4548a23 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -328,9 +328,9 @@ static struct regmap_config sunxi_sram_emac_clock_regmap = { static int __init sunxi_sram_probe(struct platform_device *pdev) { struct resource *res; - struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; + struct device *dev = &pdev->dev; sram_dev = &pdev->dev; @@ -343,13 +343,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); @@ -358,6 +351,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