Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13093675rwl; Wed, 4 Jan 2023 03:32:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwe8Mu1eVYCbfYzrjmL+DdqYBDkmkHitmvXppfhxsrqH9/ZKIUaBkndK5e3UC+wnREAg+l X-Received: by 2002:a17:902:8a96:b0:18b:b1c:68b9 with SMTP id p22-20020a1709028a9600b0018b0b1c68b9mr47084004plo.61.1672831926951; Wed, 04 Jan 2023 03:32:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672831926; cv=none; d=google.com; s=arc-20160816; b=CRrdHooUgn5bKFjU6OF0zMjTBAD51PWEFJfHRJAJpAFdPwb7Y6LA/5hzo9+nXkHWlC Fq5QvTtpsZshGpiaW5xWbs7uLjjHSy2phOFHehkJnf6Yi1QqAfY3MT5DbLgjFpt3S7Hw yk+em7RnPovL9Av7NhQorrIaSjtwD4U5F9nm/9aC9qH2I7+fLwL3k7GnmKwf0yrtRIGG LINR9TotUnW3PU8fir1jn2pjQ5TD/kbSK+WfJImNyo3ybqXhCKA4Ze5cm69XABB78uBo Vy4zJykQ1etCqqrD+bFJS66mGIAVxHDfZf/Nml49TVv/DOgofwOkw9kaOb4tVS1TYeMq cdbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZlcTytLhk9N11pg0/R+R1vO1HSpiAjIc9TUMMBJm8+M=; b=iDWUD0oUTZPhATfju+4FLbG7w10IXbLPmN5h8LGLbwR6UzAIZ850vbnVEwKNQgBE7t kv1LxTYri9i5m9PDZNP8H7l8vRPQbaLH8aov+SfdkttLxeqH1xlbCiyifv4BuvuJPXBB KZt3SRFVyp1J3BVihaExTSCQgl/nu1S7FaIeUj9WKfH1po5TFLyQzUIoGNx1osXFbi3a bXVPezTJn+MXRKrXosZoSiLCpIe17eczE7h+fKDNSisFfLepQx0N9uxr37BmFYHU5a6J dyxE5n1w6lqUdb9Cmna0JN/ZKoLaylePKIhjx7bub1GWWeSM8aG6ToZMT3HzyzzRlr34 mZnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="JAJQ/5vb"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t29-20020a63b25d000000b0047744510d34si36667259pgo.851.2023.01.04.03.31.59; Wed, 04 Jan 2023 03:32:06 -0800 (PST) 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=@intel.com header.s=Intel header.b="JAJQ/5vb"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234529AbjADLYm (ORCPT + 59 others); Wed, 4 Jan 2023 06:24:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbjADLYj (ORCPT ); Wed, 4 Jan 2023 06:24:39 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 484A81A839; Wed, 4 Jan 2023 03:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672831478; x=1704367478; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=e3dnwHcZnNjJi9JOEYjRBlsq3Z+daJrut682oSaz7Oo=; b=JAJQ/5vbLhKx6q7wP937T4miOT9SLEUJ5gVPxoDmqsOFRqUY3oQHSNBU 7AWbbGY6KzQw2ZPKnQXcn/YgCQQBv2E4abysPysFxht94nqR/lk4zXesw wuO/M1X0UCAWJg6afiAXxQ5RKZ5hAQ/7EPNlMU60cagTCEkdAdLmcbbJS iZIo5bNbUWgIrVu303CJJI6NB+EavgmXX9HLw530YYQrxjkNy0msvZsto 2vQYAS3O/u+nkDVidpYVh+Tv5/+8ihk3ZrBx47Bx/RKNo43T/tkjYCTGS hPRQWkGBE+FylpgfBwoHMhjPHfAU7aaL4hUNQKEe25ua309bG7rsnI7b+ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="305419650" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="305419650" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 03:24:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="900526406" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="900526406" Received: from unknown (HELO localhost.localdomain) ([10.237.112.144]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 03:24:35 -0800 Date: Wed, 4 Jan 2023 12:24:31 +0100 From: Michal Swiatkowski To: Christophe JAILLET Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Taku Izumi , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net] fjes: Fix an error handling path in fjes_probe() Message-ID: References: <437145bf-d925-e91e-affd-835d272c55a0@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <437145bf-d925-e91e-affd-835d272c55a0@wanadoo.fr> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Thu, Dec 29, 2022 at 05:34:22PM +0100, Christophe JAILLET wrote: > Le 21/12/2022 ? 10:59, Michal Swiatkowski a ?crit?: > > On Tue, Dec 20, 2022 at 09:57:06PM +0100, Christophe JAILLET wrote: > > > A netif_napi_add() call is hidden in fjes_sw_init(). It should be undone > > > by a corresponding netif_napi_del() call in the error handling path of the > > > probe, as already done inthe remove function. > > > > > > Fixes: 265859309a76 ("fjes: NAPI polling function") > > > Signed-off-by: Christophe JAILLET > > > --- > > > drivers/net/fjes/fjes_main.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c > > > index 2513be6d4e11..01b4c9c6adbd 100644 > > > --- a/drivers/net/fjes/fjes_main.c > > > +++ b/drivers/net/fjes/fjes_main.c > > > @@ -1370,7 +1370,7 @@ static int fjes_probe(struct platform_device *plat_dev) > > > adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0); > > > if (unlikely(!adapter->txrx_wq)) { > > > err = -ENOMEM; > > > - goto err_free_netdev; > > > + goto err_del_napi; > > > } > > > adapter->control_wq = alloc_workqueue(DRV_NAME "/control", > > > @@ -1431,6 +1431,8 @@ static int fjes_probe(struct platform_device *plat_dev) > > > destroy_workqueue(adapter->control_wq); > > > err_free_txrx_wq: > > > destroy_workqueue(adapter->txrx_wq); > > > +err_del_napi: > > > + netif_napi_del(&adapter->napi); > > > err_free_netdev: > > > free_netdev(netdev); > > > err_out: > > > > Reviewed-by: Michal Swiatkowski > > > > I wonder if it won't be better to have fjes_sw_deinit() instead or > > change fjes_sw_init to only netif_napi_add(). You know, to avoid another > > bug here when someone add sth to the fjes_sw_deinit(). This is only > > suggestion, patch looks fine. > > hi, > > based on Jakub's comment [1], free_netdev() already cleans up NAPIs (see > [2]). > > So would it make more sense to remove netif_napi_del() from the .remove() > function instead? > The call looks useless to me now. > > CJ > > [1]: https://lore.kernel.org/all/20221221174043.1191996a@kernel.org/ > [2]: https://elixir.bootlin.com/linux/v6.2-rc1/source/net/core/dev.c#L10710 > Yeah, it make more sense. Thanks, Michal > > > > > -- > > > 2.34.1 > > > > > >