Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp6591367rwj; Wed, 21 Dec 2022 18:17:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMxjS0GY3cqdylINCI6OFIYsBk+gajryogXXU17k+bQ08RJ9o0LBIpQquZZX4KY+FO1Mf/ X-Received: by 2002:a05:6a20:4f86:b0:b0:3ff8:282e with SMTP id gh6-20020a056a204f8600b000b03ff8282emr4879748pzb.6.1671675445897; Wed, 21 Dec 2022 18:17:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671675445; cv=none; d=google.com; s=arc-20160816; b=pRRquIaNSKJAQv6p5/szIM0rmIUrbZqdOQirEYPxU1YZmuhdS2/ZOqgODI6Tf3pGXr V5Qwry/LE4Okv6TOjjAJVfnAJ1NTUvLuTyjkCBYjhpSbliSQO2aVE4NhqqAcaSrIWt6u /iXgwog4ofNc/PZ6f71SnkxRihn1K5AySElxDtrO2lZugbbbXAyEXc3KT9y9f3RmppqO ZFKcOZEmY1+mRgmwETRTe3X1dtmADvoSZF3jhCRYSaVtO6wvHDEkccJJVujGSEVJ0Ao8 /DQuGwdT3TOCzstagWklyaYeBr6DeNJzOnyWAHkS+cS0tXMrFvJw/UuIROBltc+e5a27 nGbg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DByYJhZ0q+VxLFQVFX4sw4OflQe40sEt6/Q6iqz/8Fg=; b=vqhsBQjF4wTZTzyQtmdPbVJmhqYdwxhr1Y8inC/C7LwYwEvuV6z0Zg8A4ueNtX8XtH ztIvCLzcf88XYxI/3pfjUaGibmyt3sN3jSPtpPUscZNWeIaDDZTyYQiX55NjDOSmbb38 ODKRNa08zZJ61vDo1wz/9WUbLrn02WA9ltkfeSZN8WQ7xUhO7tOkxD0cSjq0hUAEBrph 0yJc3XiuhJSZRzr6UXBB0grkLyK9RawtV2286ky1I7O7p1Le3+wpHVhCWTQjAg/uJAM/ Ya76xOfupUIpedAslPaI1u83VWMNwO09HBdAHEG02A9yDlb0MRSC+XIrDiGWPSyO9gh7 wygQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hPAkXrpI; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a63fe06000000b00478162d9919si17826125pgh.341.2022.12.21.18.16.54; Wed, 21 Dec 2022 18:17:25 -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=@kernel.org header.s=k20201202 header.b=hPAkXrpI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234914AbiLVBiv (ORCPT + 67 others); Wed, 21 Dec 2022 20:38:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbiLVBiu (ORCPT ); Wed, 21 Dec 2022 20:38:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46525165B6; Wed, 21 Dec 2022 17:38:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6564B81CCA; Thu, 22 Dec 2022 01:38:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39626C433EF; Thu, 22 Dec 2022 01:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671673126; bh=QBWS72HcGu41EkBnnBrQNriIY7lz8m5hemIXlVMkIl4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hPAkXrpIQm85VDAdAH1ShLX0Ki7Yi1smUNpggq6l4GfgfuEqt6ngkhpjYUj5qxV5g VdPAcx1CEEso1uxMwyq0rzY6BzaMCMVA4Ezo3if/GK6TRjbmZ6F4euN2I6tFyoBbmk /is2vhBhajG9op59NYLmme3yhdGdeLJxQDw0Elnt4M+6x96g62C2uinKa0A+0iUote j5zO8ra8SjIdjta/ZhWl4olHYpghDBuwZDFAbHKDXi9lJj5lFiI+fKobjAK32eUUqC KGtz7tUTgtPXeuUxSSSOXb9tInVPXmtF7w+auEli8/Wll0jrhGw21Q0sSgJbRS9owr +lACl/QhHF/nA== Date: Wed, 21 Dec 2022 17:38:45 -0800 From: Jakub Kicinski To: Michal Swiatkowski Cc: Christophe JAILLET , Krzysztof Halasa , "David S. Miller" , Eric Dumazet , Paolo Abeni , Krzysztof =?UTF-8?B?SGHFgmFzYQ==?= , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe() Message-ID: <20221221173845.38e15410@kernel.org> In-Reply-To: References: <3ab37c3934c99066a124f99e73c0fc077fcb69b4.1671607040.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Wed, 21 Dec 2022 19:50:23 +0100 Michal Swiatkowski wrote: > On Wed, Dec 21, 2022 at 08:17:52AM +0100, Christophe JAILLET wrote: > > If an error occurs after a successful ixp4xx_mdio_register() call, it > > should be undone by a corresponding ixp4xx_mdio_remove(). > > What about error when mdio_bus is 0? It means that mdio_register can > return no error, but sth happen and there is no need to call mdio_remove > in this case? > > I mean: > /* If the instance with the MDIO bus has not yet appeared, > * defer probing until it gets probed. > */ > if (!mdio_bus) > return -EPROBE_DEFER; Indeed, I think a closer look is warranted, this code operates on global variables, it's also not clear to me whether it's safe to always call remove, even if has_mdio is false? > > Add the missing call in the error handling path, as already done in the > > remove function. > > > > Fixes: 2098c18d6cf6 ("IXP4xx: Add PHYLIB support to Ethernet driver.") > > Signed-off-by: Christophe JAILLET > > --- > > drivers/net/ethernet/xscale/ixp4xx_eth.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c > > index 3b0c5f177447..007d68b385a5 100644 > > --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c > > +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c > > @@ -1490,8 +1490,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) > > > > netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT); > netif_napi_add_weight() doesn't need to be unrolled in case of error > (call netif_napi_del() or something)? free_netdev() cleans it up automatically