Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21BE4C636D3 for ; Sat, 4 Feb 2023 17:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjBDROQ (ORCPT ); Sat, 4 Feb 2023 12:14:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232331AbjBDROO (ORCPT ); Sat, 4 Feb 2023 12:14:14 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444136594; Sat, 4 Feb 2023 09:13:57 -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=yfwLdUV5OBNPu08HpkznU3dMK/3+zRMaw+qY8WlDfR4=; b=boU3IvUz5Lb9rtkdkCwc23U36U wDWsJEhJMCBxMf+siIQtrhN35p2pW7RHluKNeuaCeMP89luYV1RgZLiqCEA3gMssBzOIkCXgEt93x uHUAaqSVBDJ7f1Qdz/DfhLdGbofjeT5rKHUjj3Wct4VlJHmmLvPJX+ogcIvYFksrxDtI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pOM6g-0046AO-MB; Sat, 04 Feb 2023 18:13:42 +0100 Date: Sat, 4 Feb 2023 18:13:42 +0100 From: Andrew Lunn To: Daniel Golle Cc: Vladimir Oltean , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , Heiner Kallweit , Lorenzo Bianconi , Mark Lee , John Crispin , Felix Fietkau , AngeloGioacchino Del Regno , Matthias Brugger , DENG Qingfang , Landen Chao , Sean Wang , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Florian Fainelli , Jianhui Zhao , =?iso-8859-1?Q?Bj=F8rn?= Mork Subject: Re: [PATCH 9/9] net: dsa: mt7530: use external PCS driver Message-ID: References: <677a5e37aab97a4f992d35c41329733c5f3082fb.1675407169.git.daniel@makrotopia.org> <677a5e37aab97a4f992d35c41329733c5f3082fb.1675407169.git.daniel@makrotopia.org> <20230203221915.tvg4rrjv5cnkshuf@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > The SerDes PCS units are only available for port 5 and 6. The code > should make sure that the corresponding interface modes are only used > on these two ports, so a BUG_ON(!mt753x_is_mac_port(port)) would also > do the trick, I guess. However, as dsa_port_phylink_mac_select_pcs may > also return ERR_PTR(-EOPNOTSUPP), returning ERR_PTR(-EINVAL) felt like > the right thing to do in that case. > Are you suggesting to use BUG_ON() instead or rather return > ERR_PTR(-EOPNOTSUPP)? BUG_ON() is considered to mean something which you cannot recover from has happened, and going further will only cause more file system corruption, memory corruption, etc. WARN_ON() is better, since it gives the user a chance to perform a controlled shutdown, so potentially not loosing files etc. But even a WARN_ON() seems a bit extreme. If -EINVAL is sufficient to cause either the whole device, or the port to fail to probe, that should be enough to get the DT developers attention. Then either a dev_err() or a dev_dbg() to help narrow down which check failed. Andrew