Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4041596rwl; Sat, 7 Jan 2023 09:59:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXtC3c09icx1nT9wU0xvd8cTpWPN5jqhaXF1ihrJm7/Yd2A78l+ZqsYb1FGOixF3XjrhYwHr X-Received: by 2002:a17:902:d647:b0:18f:a447:2259 with SMTP id y7-20020a170902d64700b0018fa4472259mr60008730plh.35.1673114371844; Sat, 07 Jan 2023 09:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673114371; cv=none; d=google.com; s=arc-20160816; b=pZCQyKzt2IZ2XwKIHJ9AK4dw6KvTijZtWA3mekW7GeiKoxrF0e5bpjlbRFg73qPJ77 aWpo6PRecGUSSbHJ3Fi9c5+hr7g4QzEHJs92yowBELD+rbWDJsNfObfZ0Wu/AztvAFPs OAwEoTtbrWRPe/+yu81t5ANO/LjiwxLogHszP8D7kvYZV8JGp9QBNtdCu4J6tA+1o1EW n1J8D7dmUxNw0HGxzz9FnRLDGLRQQGczfKyQTZagd2iXcDQzZDGHYq+2d/QI8ImKQDRt gzM3G4c+KYAPPi5z8e463+RD3cgKo0tHIJL6oyEnFhsT/Y49NTAcuVyKUgq1aHqAzWjd oNSw== 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=tGAtb7lLTOzzx1a9MgzHq0QMFVUZM3XHWVDSZH7D/fQ=; b=uB6Jz84al0wHIqq5oRdPBJvGH4+HqOYq+924zOim4PtWvREFd4S2iSOWOFudQTHDgO yTlKoTk6+D43Eh4Mc3CBhyAFuINM6UXiKfWQfQTm8ZNGYRYTj5XgrepxjriL+xRNOu1b 3f338Rx7mpUkILNFQHDgnm4qgGo9MrTRP27cLXFfl2nZaav/cfAAkNibTsuQ/EjxVr5H ISAxlg9uBsP9lztmhp8RukJtbqaib1VacSppAxTIe7lGGaLt06tKEbXMGn4GPHWZXyxq aksttCLA1BCy9+vt/Ireda6Sz8Y0PW4ndHd4LXeP7RadnFs9CDHKKdeSMh4E3Or4LSie J7WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="pCyx/VST"; 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 y4-20020a17090322c400b001929fa56a48si4479341plg.394.2023.01.07.09.59.22; Sat, 07 Jan 2023 09:59:31 -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="pCyx/VST"; 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 S232413AbjAGRiG (ORCPT + 54 others); Sat, 7 Jan 2023 12:38:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbjAGRiC (ORCPT ); Sat, 7 Jan 2023 12:38:02 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C81C101CE; Sat, 7 Jan 2023 09:38:00 -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=tGAtb7lLTOzzx1a9MgzHq0QMFVUZM3XHWVDSZH7D/fQ=; b=pCyx/VSTfqd8vlx/GO1BiYvFh1 r2sRKxUd9BQBInMhClhBwFNpSzidgP/Kvlonz7OsSfIbtKcyC3o9A4v4GspEAj2rL36qehW7b0dQ+ SaydYO6c30uScqBK91/9XaZ2kM57aTNbsbGz93YsISr1DpcdZzdSQkzGQB/SL6oyi6tY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pED8i-001R6c-98; Sat, 07 Jan 2023 18:37:52 +0100 Date: Sat, 7 Jan 2023 18:37:52 +0100 From: Andrew Lunn To: Piergiorgio Beruto Cc: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Oleksij Rempel , mailhol.vincent@wanadoo.fr, sudheer.mogilappagari@intel.com, sbhatta@marvell.com, linux-doc@vger.kernel.org, wangjie125@huawei.com, corbet@lwn.net, lkp@intel.com, gal@nvidia.com, gustavoars@kernel.org Subject: Re: [PATCH v2 net-next 3/5] drivers/net/phy: add connection between ethtool and phylib for PLCA Message-ID: References: <9a25328bcf2c0d963e34d33ff0968f83755905f4.1673030528.git.piergiorgio.beruto@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a25328bcf2c0d963e34d33ff0968f83755905f4.1673030528.git.piergiorgio.beruto@gmail.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 > + // if not enabling PLCA, skip a few sanity checks > + if (plca_cfg->enabled <= 0) > + goto apply_cfg; > + > + if (!linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT, > + phydev->advertising)) { > + ret = -EOPNOTSUPP; > + NL_SET_ERR_MSG(extack, > + "Point to Multi-Point mode is not enabled"); > + } > + > + // allow setting node_id concurrently with enabled > + if (plca_cfg->node_id >= 0) > + curr_plca_cfg->node_id = plca_cfg->node_id; > + > + if (curr_plca_cfg->node_id >= 255) { > + NL_SET_ERR_MSG(extack, "PLCA node ID is not set"); > + ret = -EINVAL; > + goto out_drv; > + } > + > +apply_cfg: > + ret = phydev->drv->set_plca_cfg(phydev, plca_cfg); Goto which don't jump to the end of the function is generally frowned upon. I suggest you put these sanity checks into a little helper, so you can avoid the goto. With that change make, feel free to add my reviewed-by. Andrew