From patchwork Mon May 15 20:36:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 94338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp7188877vqo; Mon, 15 May 2023 13:59:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4IENsEWhnjIhhPZXkTWX/MPHVTDBfNY7hQGRSehKqf54ff2sYNc+qK1VrTI5GO9VkRwk2n X-Received: by 2002:a17:90a:6048:b0:252:db76:71da with SMTP id h8-20020a17090a604800b00252db7671damr9357007pjm.9.1684184373892; Mon, 15 May 2023 13:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684184373; cv=none; d=google.com; s=arc-20160816; b=E4eeZXQd9CQcNPRaNmiYIp3VnvOkmEwHujsSOHjH0pol6ChyOmFNr0lu/RKgIDp1ZW IczF2Fqf8nWEFG/lXV928zhB0SEUH0NvMm7P0hTP82yFdGxpDAcmJ3XG3lE5tcHMLNm0 fqXQ/fj9xXV484Z546qF0cg2jHtsISRYBCmdf/3EMsN78pESv3GPsDKp+pG/vSDyffOH oXwtpc8FeD/gqP+hTkZr8Z8Mhe0BSfPD2N+LHIeyaB2WrCMgskoBceucaHInkMtKqatZ MVFQ3gFzDqZLvXegkWt5ije7gMUiZRJ8wsrbHxJiXbnTUWmgK8j5DYRJA9ZIu+Nq5Eo0 in9w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kB1RD+4WplvIWh7fw3+/GdX+k7JLdrHPlj+idk3PIbE=; b=LcVHToJuWFjd4bYQRAtZVY5oo0HrJlIbAx0cIy2w3ge6s0Cs02ExGIfl+qKln52RP3 S1JN8ePa2VoCNdDxqIsN+BPf/a4osapYRqPm7B5fNc1bs0aLXi8hr2XMZ+nNbSiVlyFe EUc2s7+cTNF+no/c87OvRQHf6UxEDm/TwlEWHv8aiMAisjTcsbiGKg+B8MoIi9Oi7Yph 3BdyPM5ugdBkKTtcHZhuv+Lg8w8xqpY5wwDddEHN9yvMABCrLUT460athnhI2vV3hXV/ TH83os+Q9tKJKhECxi5Z1jFgL2tr/rko3Tu3z7Ip+b93T5/KsbnhQEVCnmZ1jJw+GxTZ 4/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=J5Pigy85; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63eb45000000b00502f0d858e9si17517237pgk.174.2023.05.15.13.59.21; Mon, 15 May 2023 13:59:33 -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=@wanadoo.fr header.s=t20230301 header.b=J5Pigy85; 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 S245247AbjEOUgi (ORCPT + 99 others); Mon, 15 May 2023 16:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbjEOUgf (ORCPT ); Mon, 15 May 2023 16:36:35 -0400 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68DE4D848 for ; Mon, 15 May 2023 13:36:33 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id yevlpfkLqarguyevlp1xx0; Mon, 15 May 2023 22:36:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684182992; bh=kB1RD+4WplvIWh7fw3+/GdX+k7JLdrHPlj+idk3PIbE=; h=From:To:Cc:Subject:Date; b=J5Pigy85+HmGNs0GS2F6HLphCoLP0S7NibMZAauZTrWNyHEN3RIg+r3U9Tx5qbDZN WcHC3AbzXyYUl8XZhf5yEfgrlcnrfZueGGx8720ABz6C9hwPJFcdpEOmEOqepS1ZNq d5WdVm+YnBxDM7gXZGjCO262mrJAj3waSrA+CTwoQeX/efsXHBwxXOzI13RxaR/FFk 5R/zQdFQAQUxuXDmhvksnVscuU6EmcF6e/WWQ25gGsCef1CogVHWdf5bAAioP3bYNY uQ1Kii5ELDl1MiRzL2aOnjW1hY3uItYvfIekuv0K9aN1bA7z/9UaTSoQvPW0waHgj/ ezA13kKQFL+sA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 15 May 2023 22:36:32 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Pavel Pisa , Ondrej Ille , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Martin Jerabek Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] can: ctucanfd: Fix an error handling path in ctucan_probe_common() Date: Mon, 15 May 2023 22:36:28 +0200 Message-Id: <4b78c848826fde1b8a3ccd53f32b80674812cb12.1684182962.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765994941580882124?= X-GMAIL-MSGID: =?utf-8?q?1765995314031307510?= If register_candev() fails, a previous netif_napi_add() needs to be undone. Add the missing netif_napi_del() in the error handling path. Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part.") Signed-off-by: Christophe JAILLET --- drivers/net/can/ctucanfd/ctucanfd_base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/ctucanfd/ctucanfd_base.c b/drivers/net/can/ctucanfd/ctucanfd_base.c index 64c349fd4600..59e1708e43d6 100644 --- a/drivers/net/can/ctucanfd/ctucanfd_base.c +++ b/drivers/net/can/ctucanfd/ctucanfd_base.c @@ -1429,7 +1429,7 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, int irq, unsigne ret = register_candev(ndev); if (ret) { dev_err(dev, "fail to register failed (err=%d)\n", ret); - goto err_deviceoff; + goto err_del_napi; } pm_runtime_put(dev); @@ -1439,6 +1439,8 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, int irq, unsigne return 0; +err_del_napi: + netif_napi_del(&priv->napi); err_deviceoff: pm_runtime_put(priv->dev); err_pmdisable: