From patchwork Thu Mar 30 15:19:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 77227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1207316vqo; Thu, 30 Mar 2023 08:23:09 -0700 (PDT) X-Google-Smtp-Source: AKy350Z7hCoN8iAOJyTqCrmx8HO6bl83NJl69GdKAMG/Eswz8q3KNh9pVdxTf8PGiZMyEZqjUg8R X-Received: by 2002:a17:906:14cf:b0:8a6:e075:e364 with SMTP id y15-20020a17090614cf00b008a6e075e364mr25239243ejc.26.1680189789099; Thu, 30 Mar 2023 08:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680189789; cv=none; d=google.com; s=arc-20160816; b=pNwRAYUyqUtLWaFC8AwTurbEAllwW3WCTeOQoz6lxociSdR/HKO7laiPjA2LxBE3ge QBs7OvxjWNCCJNcV9Oceioi7cGTQbH1yj3+WXdPx7ktz4hFz23TOw53xRgr23FRCkRY/ 8rkzG+3kNFd0JBQphfiadcXL4Q6vK3ST3ZwSQVlRTr1HhtCvr7wgq3MB8RaEFtUDa6VM 9KI9lGtG5TAlaNSl42uRBDx1MK3wOyg7zNS2oESkXUmtJAKdGCTlJkA2wxWXjmTDQMKu oZTNqfaYF7MmgG6sEh9PAJEwSEqLG2mN15+xQdiDbzAp3brtDcz6o7CM7G3b8Li+SNjz Zu5g== 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; bh=OsvjpOoDock0sAK/UegZAk8PWltFIMYrUsRfrTaLLc0=; b=ZPEu5qU2TQXjrTOEQDifFNlgDMzeYXP83S4GWf/C6QfPsS0rFDpie8GH+gWfgjP2sP Kyx6QnH6Fx6VNGb4RNmsa0crvem6e6/LfLeqkPq2vjb6n0PrFXHNxRQl88SflP2qq4cE fzH63lWP6V/N+mpI6NX6n7t88z1fLfhKSBHoiUE89lC3DmSQ3IH20rkaeSS8snBnZbZT ZGS6QYijE+YhtwusBSsakqgthCChyp0rC69tRCz0mQW7xbkTxtH3ozIoeEdjliNvm646 74iKnAnGCe0PaT7i7JZ8bIXMIC4ud0kNik9quN8rnyxQTOUcLiczjVtK5va6rUXgP5ag Calg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vc11-20020a170907d08b00b009437760b7b4si643995ejc.1044.2023.03.30.08.22.36; Thu, 30 Mar 2023 08:23:09 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbjC3PUv (ORCPT + 99 others); Thu, 30 Mar 2023 11:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232840AbjC3PUu (ORCPT ); Thu, 30 Mar 2023 11:20:50 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A189D314; Thu, 30 Mar 2023 08:19:42 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1phu3m-0006ZZ-1h; Thu, 30 Mar 2023 17:19:30 +0200 Date: Thu, 30 Mar 2023 16:19:26 +0100 From: Daniel Golle To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, Andrew Lunn , =?utf-8?b?QXI=?= =?utf-8?b?xLFuw6cgw5xuYWw=?= , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Sean Wang , Landen Chao , DENG Qingfang , Philipp Zabel Cc: Sam Shih , Lorenzo Bianconi , John Crispin , Felix Fietkau Subject: [PATCH net-next 01/15] net: dsa: mt7530: make some noise if register read fails Message-ID: <9bc5f475099a4a8840842808ea1a1290abf2c0d3.1680180959.git.daniel@makrotopia.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761806688046086048?= X-GMAIL-MSGID: =?utf-8?q?1761806688046086048?= Simply returning the negative error value instead of the read value doesn't seem like a good idea. Return 0 instead and add WARN_ON_ONCE(1) so this kind of error will not go unnoticed. Suggested-by: Andrew Lunn Signed-off-by: Daniel Golle Reviewed-by: Andrew Lunn --- drivers/net/dsa/mt7530.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a0d99af897ace..18d4aa6bb9968 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -224,9 +224,10 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg) /* MT7530 uses 31 as the pseudo port */ ret = bus->write(bus, 0x1f, 0x1f, page); if (ret < 0) { + WARN_ON_ONCE(1); dev_err(&bus->dev, "failed to read mt7530 register\n"); - return ret; + return 0; } lo = bus->read(bus, 0x1f, r);