Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2583670rwd; Mon, 15 May 2023 13:53:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BplPs64X8Ra3K65zAsEkVeZf/6NkrTh+2VT7yTg2WBzEac++UuOmNi437q8L1d+jzqjyY X-Received: by 2002:a05:6a20:3c8a:b0:101:4627:dfe with SMTP id b10-20020a056a203c8a00b0010146270dfemr27719758pzj.9.1684183986397; Mon, 15 May 2023 13:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684183986; cv=none; d=google.com; s=arc-20160816; b=bCTeD4ZWxfDwOGck8vCdaaIvPASqbBZXp8lK9n0f/Qxcazy0ndCpKPaPJJ/gHoOi5q flMBL44qTViIRZqh9hWWMznYmzrr5wzrFEJlIfELfMIXkeObX+rLWxsAICcaklwsW81Q 9CjLKq0m0j9hdxiYLyyhelrE2x9XoKZ+2cTvJwzIVJYeMZcfekIht50toXpjrTECuiYI 1zuZeZlSs7S+ZhEhUEgES4gL8lm+WFa6BsboBQ1S3ZSNRw+wU5gJbLjomtLFLwscuV87 1kgxQPDU0VIio8fIT/+zS0m2So+UVwlrJgNabYzzwosuXoGDf5YGCk0SXnuSFKkwGrRg N8pw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020a639551000000b00528c6c71e0dsi16927061pgn.351.2023.05.15.13.52.50; Mon, 15 May 2023 13:53:06 -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 S244877AbjEOUgh (ORCPT + 99 others); Mon, 15 May 2023 16:36:37 -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 Content-Transfer-Encoding: 8bit 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 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: -- 2.34.1