From patchwork Fri Sep 20 09:22:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13808415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4F4DCF58F5 for ; Fri, 20 Sep 2024 09:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0nNySQPv5JuvvUtnUvrue6tL+e8BSoi+EfKgAvmGzsI=; b=W8InzUUY1Rw2IW4Ajhdwha45jO tS8VhSJKKUXn8vRWxFJdlBjqrvZ3whmzSUMU5CAQ/F15ru6LfOSYrKW56aYxWVlSPQ5z3HgOMItM9 ek5eXV/mddMNsFNSE3TsE2u08svFEviw64C/BHEgKTbyTuNxau4F1N3lPPYFttezWER+P1tnoixDF yFo7mkirdan4S5es01VREP3Do7dBKs08DN3wX5MHfDih0OScbHumwiCLPAsuFjLam1D3cNWZq1uNx HKc/kKLTLhWe89F+AGPdwSa+eVfo1J9LTaQfZB1C08uXpHGiqT9BazhzkZTPoclO96H6eaUoAAW/o ck0EIxUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1srZsW-0000000Bv7f-1Id8; Fri, 20 Sep 2024 09:24:40 +0000 Received: from mout.web.de ([212.227.17.12]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1srZrO-0000000Buzr-0PqF for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2024 09:23:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1726824180; x=1727428980; i=markus.elfring@web.de; bh=0nNySQPv5JuvvUtnUvrue6tL+e8BSoi+EfKgAvmGzsI=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:From: Subject:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=h06ZOlvDpqKN9GEI6OZpQjV7HDyzb5JY+L8OmetS07KvIwK9pAHfbbwoGhxrKbJ/ rPQjrVS4OHjhlr4+k/tE5JRtWNfe1E0I0jMQKArNXNrVfj4uN0XgZ3mc+Gzu7lnfZ OsjzaoFrXN8EPZ6ihqadVZ5jks6slmtCkxyyds5arz6+ra8U1lu70zeRJATPbPnzN 6Zgtbm1i90EXfP3gbnKJZAv4/LVkdr00ncgm9G7IaZJZuMm2N9Q4IIMjmjyOYEK2R 7tqsKlxeKSG4KrQiLYpKtfjFmIp0y54l+S2FnCF4EuuT1VSusLMO+W28qXMZQxUbx xMy8sShQwWNMajJ3PQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.91.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M91Po-1svP4E05Sw-009s7C; Fri, 20 Sep 2024 11:23:00 +0200 Message-ID: <2e6f6f8f-89de-4b75-a0af-3a55bc046ab7@web.de> Date: Fri, 20 Sep 2024 11:22:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andy Chiu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Michal Simek , Paolo Abeni , Radhey Shyam Pandey Content-Language: en-GB Cc: LKML , kernel-janitors@vger.kernel.org, Sean Anderson From: Markus Elfring Subject: [PATCH] net: xilinx: axienet: Reduce scopes for two resources in axienet_probe() X-Provags-ID: V03:K1:4TFXBdP/6ppeVrRdSDKHEfkmbT/q5U55VcdfqXXjsKvxrj4eEXo kWDIihbCgMzIicmxVfxxuPDNbibnklTw5H1Edwnskbp+uC26PMd2wLBHC0OGkH7DwBywFtP qkgYT70FOAuv8iuoDnW11YwXEkxTyYoKFbr09y49dapy2qmvBhXhAjCmH//nZ7zly4HwR6F /gojlhYsSlRIDhCNxIZmg== UI-OutboundReport: notjunk:1;M01:P0:X7tOIUn4bU0=;1LorCimN8vn4JkCAiX8UOd23rws M7+uwCuqghvLX2Zht/5EmNBL7lr7ER9Ln6No0Vl/MsJzya5DAkH+fo/MI89ysAvFrgzdN17uW LOo4adbutwdio3PWz8jOj0tu31p7o8egRZpcV7bL1c/ZOpPX/yQZASUMjhBTckIUJai05gzTq ZMw1fALTx1A5f9/Ws7XaiZoSUrHaZdtZ1t+9VK52hM3Sf1oEeT1T9EO4LKi+Xa5olaZMV+y9d ugDbAYCZudQK8DJvYUvVJH1qjorB3c7c6qqGpVv9p2FmAmjIEl1JkEsyV9/Hsjeln0Jvb4dwT aLezLOBQUsMxtc79/Z+aNFGz37T2417RZS0K321PV7JUp9QBPIAA5CncP+/DeJ0CvEfHXw5NS Cr4L9pOtcT7ToPojiG8HelAKwP7YiJ7Al4Phgl09hKrhJzYKeKZt7rYmrT/rYMjBoiJckd03D qXr3Avikvqis+4I0yW1dooPbYtwO63kj2jPZIkKIkUKswRbb8LKcrA4QhvYd3iIjoN5hms9/u LMOhRwCNS2lvJoMHoM1NEzlFiGkuIdjsBANKVcxEtHI0RwNTlbV6ZncZ2I+ZM3avlhzTT0kEE YSBtF3bxs7X5ikPO8zolWmKF/hn2vq4S6ZJeFE3/FdsRvLrIMewfxUlKIoYXp7S9eK7iVRiZJ 2NOALEMHg70q7/C7R20ewptkeRo47D0ouZ/VUvd+Dcb3PNARZudgzNYLR4Nq3fa2QibpUpP6Y 6nqbmSirpQ7weoELnfEmlIdbpGCX0DbKc4zkgMnzz1WPfHYhg/UEjXuLC0KkTXrA3ugMhWGFP NdTt2n41GhI+XgvbZglbELzA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240920_022330_543905_8B0F2CA4 X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Markus Elfring Date: Fri, 20 Sep 2024 11:08:10 +0200 The calls “dma_release_channel(tx_chan)” and “of_node_put(np)” were immediately used after return value checks in this function implementation. Thus use such function calls only once instead directly before the checks. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.46.0 diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index ea7d7c03f48e..e3d9801ad17e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2806,13 +2806,12 @@ static int axienet_probe(struct platform_device *pdev) cfg.reset = 1; /* As name says VDMA but it has support for DMA channel reset */ ret = xilinx_vdma_channel_set_config(tx_chan, &cfg); + dma_release_channel(tx_chan); if (ret < 0) { dev_err(&pdev->dev, "Reset channel failed\n"); - dma_release_channel(tx_chan); goto cleanup_clk; } - dma_release_channel(tx_chan); lp->use_dmaengine = 1; } @@ -2860,12 +2859,12 @@ static int axienet_probe(struct platform_device *pdev) goto cleanup_mdio; } lp->pcs_phy = of_mdio_find_device(np); + of_node_put(np); if (!lp->pcs_phy) { ret = -EPROBE_DEFER; - of_node_put(np); goto cleanup_mdio; } - of_node_put(np); + lp->pcs.ops = &axienet_pcs_ops; lp->pcs.neg_mode = true; lp->pcs.poll = true;