From patchwork Fri Dec 9 22:47:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 31944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1028921wrr; Fri, 9 Dec 2022 14:50:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5RZRSjgZXWtCQiulcxiADL9kk3IflfLDtXsK/TiRi/vuLdMA4y3yIFzynSSzNndbVdrUPl X-Received: by 2002:a17:906:38c8:b0:7ba:5993:90e8 with SMTP id r8-20020a17090638c800b007ba599390e8mr6259119ejd.65.1670626251609; Fri, 09 Dec 2022 14:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670626251; cv=none; d=google.com; s=arc-20160816; b=TIP2Lzs4DFE76k/CZj5R9dKMq+SmN9safuxlFDmj1UmYD4Eb9lZSzRuHv8AwbpAbot ikX9ekrDANXOa6USqGLMXu/637UIlmzbfwxpxKtZfQAUicNEzt6GIl43L1+/vYblZY+F nA3ibru/hwWcPavn5Art7Pqe+ckkBp44+TGP14jqz+6UisyRpJDKvHHqPMIhzLjgm3jt dnXBwScykVkJBGcOq+Hm5KwZVwt+wNDA7j8D/sMEcuY7byyyGWo6i48t44NNvrFNCqv/ G5Z9jDAZnKpnotyTnYQ3NxRG8v6Hmiej/oozgVDi14tXidDtCaT8Qn2NrGNWkCmJ9xq0 Jo/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=RRd5g+dOpsaZAILzWmtnqtAGKKwPxVKxYmY8c9dV/44=; b=rUK8LQaXXAaI951cdxvns4zinsotQHZdncJyGC8X2xzOTcgfAp70S1P+Sl8lOIrIcp cZTQZiNa9kltaxrS3MKnR9CrhnRN0ShT3630KR9+BYJ2Vi0kz0SoXwTOcQikYLH3aYdK AbeMPUqKJjS+Qj3Xzx3Q+S7d2L1OcVWd6Z0GONt51wEHXx5EoxGRBasQmEDowiysWIOW 6x+lxFRHkGedopUxWO8P89gsB6D5DLnDkGjeTTEqDwy2WAZ9Go2RY5predKGaf6u6ht4 f/L32EBTDWYaxygot34hi5qS8BEsKgxdDHh+Uy4kkyc8SgXRuJhC9VDNJsABN+UrpWqa OSqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=UanF4I5g; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn14-20020a17090794ce00b0078db6f488cesi993153ejc.112.2022.12.09.14.50.28; Fri, 09 Dec 2022 14:50:51 -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=@microchip.com header.s=mchp header.b=UanF4I5g; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiLIWrm (ORCPT + 99 others); Fri, 9 Dec 2022 17:47:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiLIWrV (ORCPT ); Fri, 9 Dec 2022 17:47:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C52A5DDC; Fri, 9 Dec 2022 14:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670626040; x=1702162040; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=B2lfXxHngQm03n83AdhmQkCAaE+4zb2T+WSAC7zt58o=; b=UanF4I5ghcQex1rlFV0NZZfYDT/Kl+4h3Vx/pDW9gxbv1HNln03R0+SO 5OQEdb0Aly1ZqhUrhVwHBYEn8ZeapnVN/BvVn1K5l6Z6JZGSOcyurbGNF Gv0nIM61dG3LYBau8vhWtPGcBH8J3/GGvXCfUlBr9eT6hkw06nO5WLFj9 y2dUKlNJdxJfi0DPZUTi9z2+f7peJZCHlNa9xcolhjy5jG8bUcoabNPtG 7H4qyvU+xZ6vjLXIAJmlDwSMfMlfJZuth/aLzrIvkDGCVZ6PXdK7/vfWD +84MLyPFgZDCZ/qbhOIEIf7Zle1EeAQM0xHeMVaujQUrZhQ4KwruO3c9A A==; X-IronPort-AV: E=Sophos;i="5.96,232,1665471600"; d="scan'208";a="203381007" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Dec 2022 15:47:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 9 Dec 2022 15:47:18 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 9 Dec 2022 15:47:17 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , , , , , Jerry Ray Subject: [PATCH net-next v5 3/6] dsa: lan9303: Add exception logic for read failure Date: Fri, 9 Dec 2022 16:47:10 -0600 Message-ID: <20221209224713.19980-4-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221209224713.19980-1-jerry.ray@microchip.com> References: <20221209224713.19980-1-jerry.ray@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751778592244107502?= X-GMAIL-MSGID: =?utf-8?q?1751778592244107502?= While it is highly unlikely a read will ever fail, This code fragment is now in a function that allows us to return an error code. A read failure here will cause the lan9303_probe to fail. Signed-off-by: Jerry Ray --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 20fc2af62531..b0f49d9c3d0c 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -887,7 +887,9 @@ static int lan9303_check_device(struct lan9303 *chip) } /* Virtual Phy: Remove Turbo 200Mbit mode */ - lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + ret = lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + if (ret) + return (ret); reg &= ~LAN9303_VIRT_SPECIAL_TURBO; regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg);