Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1279909rwb; Tue, 29 Nov 2022 11:14:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf4PUmDYkKKMpX64cNcdpm3L51N6DfC5jMRSfbAwOE8OBZrU4pUGO/5fpCjhF/FZaOvwIpY1 X-Received: by 2002:a17:906:381:b0:78c:b8b0:9d35 with SMTP id b1-20020a170906038100b0078cb8b09d35mr41351879eja.586.1669749290047; Tue, 29 Nov 2022 11:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749290; cv=none; d=google.com; s=arc-20160816; b=wIMOSlz4dobnrAZIbAiTJt1oKgu0pok3pghVOfPZCYX34p7qAcS4itL4FbdPircCxS Su3D0fYKiB9Q3V52PceC/cl89gRu6c1YBkhR7e56koRZc5OunVziisAQOhdcIWyTtEi0 /cOh1f7j15TjD0VcwxuO1uPz2yP7yISx/En8eey1Rv+mDaGPxCV42DIm8QG/NpO8bndS u/QiMvQLAE5mKU18zpiu4WxZUXNxYtOVlaQ+IY735rd9ynD1jmfaNw+chKJUfVxT23Kp Mjwutk8nrP6LlVH1ETC85xMGZzyM3MDKCGE+HpD9ltdYGxZUpnaqyyhZ+SQUKRH5p5hK x+Xg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XpEeI/9mKQwH7FbdFrYBkMz1l2jJHzNNlZ7rFT6aPG8=; b=OfBj88sQpaGlo3gFjOZlSeOp4t9QAD2/N+YSLBfshZh9s9tDU3gjLuokjtKOJUH8y1 yXOcG3qkmNF0XV+VTiOCMSV84bsa9txSvuO2w0zhqmMailALMm5by6u12suNTC1Tp5cX PuSOXzf/MUONmA6BMSRAfpXoEqEBpjMDjmLO4XA3VHwqX7yjqlpj+YthWmtC9+clj5Ug ozt3SYNcJKovo+1ZqohSfzWIANTuKZ79Yy9szoSXo3J/V9DDigaeZDE1wdfaWsCsvtIw FCNmznv6KdAqa+xJLaj2sZ2VxdrRELgq8Cj5Hbw5tt7MbfgV844pGzSeryLzX4q/71yx 5nsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2cByblDp; 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=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg33-20020a170907a42100b00779a3220c5asi12995439ejc.343.2022.11.29.11.14.28; Tue, 29 Nov 2022 11:14:50 -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=@lunn.ch header.s=20171124 header.b=2cByblDp; 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=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236191AbiK2Sv7 (ORCPT + 84 others); Tue, 29 Nov 2022 13:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236192AbiK2Svy (ORCPT ); Tue, 29 Nov 2022 13:51:54 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA613C6F1; Tue, 29 Nov 2022 10:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=XpEeI/9mKQwH7FbdFrYBkMz1l2jJHzNNlZ7rFT6aPG8=; b=2cByblDprP8Xs/49TMYmd39s3/ 4Z+1m9pffoBseTe8ti59Lh00z6V/yQ8reHGulCF/5AlspB1s0I81IWVt5n9ht8kn14GsEh+i+bol7 eRaXzEWqVEWXEI/XC4X6mWAcj1rhVW4jVd925QTolUI35OfZulonxJCktMFD0wAFBIZA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1p05hq-003u6g-5c; Tue, 29 Nov 2022 19:51:46 +0100 Date: Tue, 29 Nov 2022 19:51:46 +0100 From: Andrew Lunn To: Vladimir Oltean Cc: netdev@vger.kernel.org, Ioana Ciornei , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 04/12] net: dpaa2-mac: remove defensive check in dpaa2_mac_disconnect() Message-ID: References: <20221129141221.872653-1-vladimir.oltean@nxp.com> <20221129141221.872653-5-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221129141221.872653-5-vladimir.oltean@nxp.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 Tue, Nov 29, 2022 at 04:12:13PM +0200, Vladimir Oltean wrote: > dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if > dpaa2_mac_connect() failed, or was never called. > > The callers are these: > > dpaa2_eth_disconnect_mac(): > > if (dpaa2_eth_is_type_phy(priv)) > dpaa2_mac_disconnect(priv->mac); > > dpaa2_switch_port_disconnect_mac(): > > if (dpaa2_switch_port_is_type_phy(port_priv)) > dpaa2_mac_disconnect(port_priv->mac); > > priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns > false, and dpaa2_mac_disconnect() is never called. Similar for > dpaa2-switch. > > When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned > zero (success), and therefore, priv->mac->phylink is also a valid > pointer. > > Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn Andrew