From patchwork Fri Sep 20 11:01:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13808473 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 31C08C78820 for ; Fri, 20 Sep 2024 11:03:47 +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=5lLOSFSG9mhzZCxoUT9gqo2ko2jbykdEX5ZMcrTCqqA=; b=hT2UKijotV4gj0SpzO18Kso5oa S0cJ+MoV0khKh0rYTKJ5QU5REgP1kcTdg1mLElSypN040MLWSBaaM4XZR6bVW+q2Cz9OHUrvbpI6F sMXbw/+HVKk/cKbbq0t9tDKkzZdkaDooYk77//My9R6fQK9GaQulT++1BqLgzbIGqKo67G5IN3DMI lJBSf0hJbXGgoG+9wAgoqT/P51/QthK8Fn2gbqeLzshg+oXwhMdGQZIVtVC6vq7n6M8428lOKtDA0 sGOW34Q6d6ZbUPG1auvtbEKTNlpA9482TgbewR7VeCOchYCkST9YWJOana3OjY0wDHEK3xuuC1bmx HDYFtrug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1srbQD-0000000C33x-3UkP; Fri, 20 Sep 2024 11:03:33 +0000 Received: from mout.web.de ([212.227.17.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1srbP5-0000000C2vh-2Kvu for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2024 11:02:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1726830110; x=1727434910; i=markus.elfring@web.de; bh=5lLOSFSG9mhzZCxoUT9gqo2ko2jbykdEX5ZMcrTCqqA=; 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=Cv5twCDSbYPidcGkWUgi7bInQ6Fxt8KoL3KQsfc7TucWyrukC64G2E1K2fPwvAeB bR8OTIhXmvamJJyols/2+trVzLgswsmgiyKRZ+uOi9NG8k1J4fYBH0PNWsNnJSEA6 TcwKc+Wnwq0XYB/oKFfpe6oW+2/hshpdSrCm9AaEInmHUhCWoAyqBey0v3dcoSBsq gUxAPjNFTnVXiWUWEvRNz+PsDZozCuUFGGoMAQkuCTehADlFg/6n6+i+hTdV9SoVN bYZ0OJg6NI6MqoyJJCqHEYC7MjcuuDyVO3qoNQqMq5tTSsE2bbjS3yYnxuUMgm8ur ZUgaQK7208TDb49VOQ== 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 1N30ZL-1roXaK4B7l-00xQV9; Fri, 20 Sep 2024 13:01:50 +0200 Message-ID: <330c2b9e-9a15-4442-8288-07f66760f856@web.de> Date: Fri, 20 Sep 2024 13:01:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Clayton Rayment , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Michal Simek , Paolo Abeni , Radhey Shyam Pandey Content-Language: en-GB Cc: LKML , Julia Lawall From: Markus Elfring Subject: [PATCH] net: xilinx: axienet: Use common error handling code in axienet_mdio_write() X-Provags-ID: V03:K1:XSLuD600Eg4etH3tvnH0Z216mHgPuhqWJhqAUwh8thyKuaNPK7b 7hKHWQcJoMgZz25PixI9t6PfNYQv1UrER3UAwJ6KbZuU0L0Lr91Idfim20U3hyL2mmrPVs+ uuMizDENCkPTp2KU+o2f1GuEks1LUhQggcB1QVqxjkHq0U6PoeiGPF4Vv2nE+K7nzuHb7IJ t5BO7XyJ4qy4V5W6u64wQ== UI-OutboundReport: notjunk:1;M01:P0:Hubf6ZAdFMA=;He1VW0lUejwFHQ4NrAyPLsRNwEY ygVjG2gIdm+zMr/WlfqNMIP9d5/vGSIuB5lNf/o3HO8OMtDhtMoclcheYq4CI7XW9QuA4CyLC QT4jUWdErG7p2Fr5RveylqrD0uIR7zL4ZYbOpJrYVqt2t0KWQ3UaUFiEPq57evnKC8DWp4aDw Iukf/aFLPjVkPnuMwaa3oQg3gnuhYQYa8tKu10j+MN7WpADrQg8w0f8nYkQdPrpAjXzZUmlEV ZzAMwL1+JsfiFhq9zoXQU3gK4iomGTWh+FBYQUmSW02Uj3FDKr2gDJbAPslztmYG2tDA4jdFY HIfPHxn5fTETb/a8jjVfMaoKzAtgB79BC1NsWGwO6SJNdd+U/bHDGI8V7gGHRmvzL8eFKUZ6o 3FxoUIUiM16C+zUs9PEJuR5MsNexRAPnQPRiHYf0scXRmtfVLkGsNpMYi+lBN7VFvrtzip4DF /FukX580jzbbjwqjxHlt3GuOHAcAt1X5ffTjIGwJGPsgov0Pi/wSMv5aZ4ztBdPWVWr2zbsTH QkBCuHdx0x5E88CYi/I4o2Gc/D30/pEEMcLfsrohxO/kDO56MFBVtC0UnAa35qm1yQdoeJPkm wvjRjomnWrBc+s2Qz7IwAbICGkGeT62GTe+hFvQ10Vel6YGta0q09Cdoxzyr03xA9akbQBGWT RPe3wMp74rxZoQwGhHPui2q3VZwjHAmUgrkstcHxbYareIYtjAtBsKH/n3l+QNbdCQIyHogS0 26sy2B3AWLFTUzsaMScNOeBMsFG58B8US9kZ9DP7vcLMKMYPF7faDQzDh0W7+gHhLb22AVI77 gi3H2clcwOeL7mcRGVAnnHXQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240920_040224_107349_2687A1A0 X-CRM114-Status: UNSURE ( 9.37 ) 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 12:43:39 +0200 Subject: [PATCH] net: xilinx: axienet: Use common error handling code in axienet_mdio_write() Add a label so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 2.46.0 diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index 9ca2643c921e..0c7b931b2e66 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c @@ -138,10 +138,8 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg, axienet_mdio_mdc_enable(lp); ret = axienet_mdio_wait_until_ready(lp); - if (ret < 0) { - axienet_mdio_mdc_disable(lp); - return ret; - } + if (ret < 0) + goto disable_mdc; axienet_iow(lp, XAE_MDIO_MWD_OFFSET, (u32)val); axienet_iow(lp, XAE_MDIO_MCR_OFFSET, @@ -153,12 +151,9 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg, XAE_MDIO_MCR_OP_WRITE_MASK)); ret = axienet_mdio_wait_until_ready(lp); - if (ret < 0) { - axienet_mdio_mdc_disable(lp); - return ret; - } +disable_mdc: axienet_mdio_mdc_disable(lp); - return 0; + return ret; } /**