From patchwork Mon Jan 9 21:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Ray X-Patchwork-Id: 41152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2386397wrt; Mon, 9 Jan 2023 13:20:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsSxWkBx4bhFB+GzBZEs5JgMFmZwbBHfGdMwLooYL5H5h/BkIQXJsUmt6bRafY2jiFkOq1K X-Received: by 2002:a05:6a00:2d8:b0:581:fdfb:9765 with SMTP id b24-20020a056a0002d800b00581fdfb9765mr35786969pft.1.1673299216492; Mon, 09 Jan 2023 13:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299216; cv=none; d=google.com; s=arc-20160816; b=hZh86bh4n8kKST0UZt6B99n57p2WhcoR0+M38WCnKNy9nfe/imUXWIz0PRxv6Nn5TP u/7gEKpFA/NC6TRyJc5y9D3V3SugC8pRZORHoqTrOrVas+qtRAUrbIgio4T+7KXmID8B NaOjHH2megaboM6j87jznmF8wKU7BSKeL8gfM6aelCieYc4oTQV1YZcIT9KYb4D/cwIh jMK59+oifdpODvxRD5OksVBZBKUvvtpGLg+rceF1ufb/Vbitd27h3Pgb8EiL3JIzWntm jbMYRHUCgtRYvJvIR4Jz/SVUK5L0iVId1ZWYUDO1MDpMaRJO/pzEV5kCbLcEy0iGILfz 4H/A== 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=/RDqyS1oYObbYjSMasdava4WvX8XdcYB+Qt4b/4lVbo=; b=bioGZajKXiG2UXCw4b6llrBOMyISazCp0/3crnckmzfUEl3cvhR3XJuoyvcTvBa20y qM+J9YutGN403Sbp1KfY4fmOUPUL2P922IuCcXIR29Ow/VMyMi+2neIOGTcnilBIe3H+ PjzMG+Id/TiViKmrYu7gzY/HKi09eWOdUvQhbw425SmS86qi/i2pohAwzQKd82eSTCow V7ZoY5ZghhYHYO6O3+pvQDp/5iiFg+42bVBBnDHnX84JdjsNHYLkE8F440YvWRddveT5 UqfmxgmbPlCb9YhGeeAV3MGfZO2JO132cLdvRqd1X1FwLjL1B7FcOarQ0ZTQGkE2FqZA qpMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=rLjjGqJ9; 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 e15-20020a056a00162f00b00588a0da3b50si3105965pfc.61.2023.01.09.13.20.04; Mon, 09 Jan 2023 13:20:16 -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=rLjjGqJ9; 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 S237927AbjAIVT4 (ORCPT + 99 others); Mon, 9 Jan 2023 16:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237554AbjAIVTV (ORCPT ); Mon, 9 Jan 2023 16:19:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDCC189; Mon, 9 Jan 2023 13:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673299144; x=1704835144; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=VxkEKNZWJ3KcbW8rhbq+3YllhYbn54Q2UHPI5yThc9c=; b=rLjjGqJ9wClvDy/rJaz7WXhSGdZ0W14ay/pj/VXLOU1VCr1ieBLr3Iqi TVhWDIlQqQ0OUu0SGYtaafMVobiIaMZXXuF0Q3fkfAivFZZtY4Xrp5BHU RcjwJC2J4USKjkDyQ9j2q74fC8kdmgkYBI80VVRzOGfLkNU4jiitkfdly 0a+dX8HsfcgefJMJhbYY2/IocicznELetZBmDwHGaoGxifXrX5Iqphmq/ SITqg3j+0sGnOQaP/aEhNbJ+8l2xFjaN2Hji4QBp++dGRoCVdofeGgwzV EGjJv2Gvb8Xpf750jC2zd9g34qZfEi6XyYPm5R8jeaUzqbAwCd5oS40fP w==; X-IronPort-AV: E=Sophos;i="5.96,313,1665471600"; d="scan'208";a="131543896" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jan 2023 14:19:03 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.16; Mon, 9 Jan 2023 14:19:01 -0700 Received: from AUS-LT-C33025.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 14:18:59 -0700 From: Jerry Ray To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" , Russell King , , , , Jerry Ray Subject: [PATCH net-next v6 3/6] dsa: lan9303: Add exception logic for read failure Date: Mon, 9 Jan 2023 15:18:46 -0600 Message-ID: <20230109211849.32530-4-jerry.ray@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230109211849.32530-1-jerry.ray@microchip.com> References: <20230109211849.32530-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?1754581399334041602?= X-GMAIL-MSGID: =?utf-8?q?1754581399334041602?= 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 50470fb09cb4..8eee340f6464 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);