From nobody Thu Dec 18 08:38:58 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1340C71153 for ; Mon, 28 Aug 2023 08:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbjH1I17 (ORCPT ); Mon, 28 Aug 2023 04:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjH1I1h (ORCPT ); Mon, 28 Aug 2023 04:27:37 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE8C1A0; Mon, 28 Aug 2023 01:27:33 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id CFF701864F2E; Mon, 28 Aug 2023 11:27:30 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id g40DCzp0QuPr; Mon, 28 Aug 2023 11:27:30 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 753F41864EF4; Mon, 28 Aug 2023 11:27:30 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Uc5eHaw1c0Xb; Mon, 28 Aug 2023 11:27:30 +0300 (MSK) Received: from rbta-msk-lt-302690.astralinux.ru (unknown [10.177.233.169]) by mail.astralinux.ru (Postfix) with ESMTPSA id 315211862F57; Mon, 28 Aug 2023 11:27:28 +0300 (MSK) From: Alexandra Diupina To: Zhao Qiang Cc: Alexandra Diupina , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH v2] fsl_ucc_hdlc: add a check of the return value from hdlc_open Date: Mon, 28 Aug 2023 11:27:03 +0300 Message-Id: <20230828082703.3246-1-adiupina@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Process the result of hold_open() and return it from uhdlc_open() in case of an error It is necessary to pass the error code up the control flow, similar to a possible error in request_irq() Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC") Signed-off-by: Alexandra Diupina --- v2: Remove the 'rc' variable (stores the return value of the=20 hdlc_open()) as Christophe Leroy suggested drivers/net/wan/fsl_ucc_hdlc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index cdd9489c712e..4164abea7725 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -708,7 +708,6 @@ static int uhdlc_open(struct net_device *dev) hdlc_device *hdlc =3D dev_to_hdlc(dev); struct ucc_hdlc_private *priv =3D hdlc->priv; struct ucc_tdm *utdm =3D priv->utdm; - int rc =3D 0; =20 if (priv->hdlc_busy !=3D 1) { if (request_irq(priv->ut_info->uf_info.irq, @@ -732,12 +731,10 @@ static int uhdlc_open(struct net_device *dev) napi_enable(&priv->napi); netdev_reset_queue(dev); netif_start_queue(dev); - rc =3D hdlc_open(dev); - if (rc) - return rc; + return hdlc_open(dev); } =20 - return rc; + return 0; } =20 static void uhdlc_memclean(struct ucc_hdlc_private *priv) --=20 2.30.2