Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1731883imn; Sun, 31 Jul 2022 20:08:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Zo6rj/th17Dpq0w7OwBoidw+CDIhnHK/99Ywr/PZ2rtfYUqryO7ccaluzxIOtzZDpRYqj X-Received: by 2002:a17:90b:4b50:b0:1f0:5643:fa5c with SMTP id mi16-20020a17090b4b5000b001f05643fa5cmr17939393pjb.131.1659323327950; Sun, 31 Jul 2022 20:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659323327; cv=none; d=google.com; s=arc-20160816; b=dnhARBNGN1e1zdvEISJGdjC5MSOcDb62cRXgRALjFOqjpIQSTv8PzIRJLDhlYU72JI LrtsK9x+4q3Mk9s+sXq9W41CGUCSK1SAmYdm+RHUcnfcoUkY8U4wJMTEGjFQvlDlkuBC YUel7Bfy/KQKlDd+TJpGQP0H5We/FJaHMSfnC51D5CZe5WA3aSPp18pDVp7xfC+uW/4j 0s/S6NlQfGus92rXoeZk8/UGHhpUKBv2jiiqCATmYYmntsBIoaUPGmUmCaMvGjb/NOmc 0F447k2KHXP777f4QnYylQpcqUwzTBjGwsD99gAx+XjsA+5w8gfrTtzPGGQahTZhPYXv 2F1Q== 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 :feedback-id:dkim-signature:dkim-signature; bh=bKbLq8gXyaC/nciXymlgvBGqzJKGfY3EeYJHQps9uFk=; b=OhyYhUgC0OUISD0M0NaEMaQkkQz9pd6oi+drBuIBWpZBNFaRfK2O44n3NNE81BLFA0 yd8Ua4FB3k9YKg/oTYCDUVoZL/W4cjn1yNAS+fKyI9qIEbT4zkMp9qviyPXARt/+B4ft oFaG0K5OnZMQIgwDgCwtNfReafN4gxGSY3Xj7hSqT8JLcsyJOcWU+Sqq4mZrMFxBfxnK /+Tn2XkiePQe3pr1to5i2Ef8iqJ+mLbnpLeALx8rf3h7Vh1vFDY966+/XdIAEUmGMmx0 ipY8stMq9xMjx9iw3vUhh5khsNX+ffT3zAXqClLXQ+ugyD1TOzG75FzzK/5Xz0oIuYSp J9dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=MyJcbt5T; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=PLpcmrBp; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a17090a898900b001f2cc064108si8884916pjn.140.2022.07.31.20.08.33; Sun, 31 Jul 2022 20:08:47 -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=@sholland.org header.s=fm1 header.b=MyJcbt5T; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=PLpcmrBp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239550AbiHADFo (ORCPT + 99 others); Sun, 31 Jul 2022 23:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239517AbiHADF2 (ORCPT ); Sun, 31 Jul 2022 23:05:28 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A16A260E; Sun, 31 Jul 2022 20:05:27 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 766553200077; Sun, 31 Jul 2022 23:05:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 31 Jul 2022 23:05:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1659323124; x=1659409524; bh=bK bLq8gXyaC/nciXymlgvBGqzJKGfY3EeYJHQps9uFk=; b=MyJcbt5TZlAyb0UE1/ +XIHxklCzbXhu+wr+ER32MDbN0NvOTqY+wSgYKXkha3r0KqK52Qko/1v9MGXwLda rH1n/fTG596lu5SocVL6L4Uk4eI/PNp3OQx/watQBq2wbM3hyOgOqZ2QMvoyZPO7 aFXSwXFo0IBUQ0jFKkp1Vbih/cJC2+ruSWOU7TN1tdNwG7zmtkgPYV3giI5wBAOD lBUoI5/JztXjzXWjLVeQRxz4IBNzLIURHPQARzu0EOJHxpO0K6pEtsDgQ/l/ieSJ qc91TY6OMw5RYXv62RWju4sksiU5b/eRTt99JVrEVwu81xmWCYird6kDnkhH1Suv uC7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1659323124; x=1659409524; bh=bKbLq8gXyaC/n ciXymlgvBGqzJKGfY3EeYJHQps9uFk=; b=PLpcmrBpmOE5T/AJeRVL9k6HIVl7V IMwCYJAcoeE7yStOUVKwXYoQFEf3v8xO4TvnY7JFyUnnCaKouhhmJ/olJOhHLtYw p+mkCTYA5a3j2iHY7J7WpCoDZiMJap77dGWzo0iHJ0zfRz4JN4qQUwL9GhOobkoQ TQS0RtMG20ssUbWItykJ+c8WER7b0+Ki/hl9B6q8HSluQ/8/1dM8mHdIM3qEiYN8 eYVvRy6mWBTizietF/dEScTjJ5z1VNtS9dNqZ0FjTTcAElK3KmMwbmhmT2asLA8z +12QOzpDigWunR5Yr7sRu6UBIAKmmuetjcAK31+b2eMthPmnfQN/fooNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddvvddgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 31 Jul 2022 23:05:24 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec Cc: Samuel Holland , Arnd Bergmann , Hans de Goede , Icenowy Zheng , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 4/9] soc: sunxi: sram: Fix probe function ordering issues Date: Sun, 31 Jul 2022 22:05:04 -0500 Message-Id: <20220801030509.21966-5-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220801030509.21966-1-samuel@sholland.org> References: <20220801030509.21966-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 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") Signed-off-by: Samuel Holland --- 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