[net,2/4] octeon_ep: ensure octep_get_link_status() successfully before octep_link_up()
Message ID | 7e653ae15e1368ff33435da7c6df94d5e5d4fad0.1668150074.git.william.xuanziyang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp589212wru; Thu, 10 Nov 2022 23:13:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf7OTEw80UTDwlCVix4OfyphEJWcr590b4pxOL4AgxqoDHPzlCmyB4I+iZazqVtkTVXLq+Uw X-Received: by 2002:a17:903:22d2:b0:172:9db6:3c5 with SMTP id y18-20020a17090322d200b001729db603c5mr1291636plg.110.1668150807526; Thu, 10 Nov 2022 23:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668150807; cv=none; d=google.com; s=arc-20160816; b=boGaC39yEe3rkHsM6gPUqUyoaLC8XXPPND2GEBcRSeN1+fiAxamJ2qfuLw5FbwWykk kvPtuXAnx3s33y7V/kuWowiisPWb3kiDuOTKiszzuRlbY4v+c7bEYodrmn5t4jlwn5Rd 87uXHTNMKZrKzpSnjTXwExCiN7ITI2lcftPUUGNlOrCXVGAW/wzUhkg/tb3nRYwGTPHW GAvJ+Q9iqAJOcy+Cr4nCuiapzoHGfeAjLGw+wk4aYLn/N4Das0/Hfl2cfwiVHBzaBTNA GP8HyEHoqSowvUqwWd3g7f5x8eBWgCejT9HykpuASyGt5RCwgln/tGOYPY+UhJX/9GJa 8iag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=mbUy28BPcxJAhSNZO1/+JJECcaHhrXAJCQ2W2T/8D1U=; b=KShNANbd1PhnfRcJINnUVGV1FmgtukfZLoJCkzqH6rc5OsvxwqpkHViyPW2nRtIO0W y6hIr//rl37wrOMnJraZOLL8lSTeM9DB0xhK1LVxn92MGJxQIOEgv3UWEfyyEsV+1lHi ODWDygQ8iUeUhU3oqMTK+HtbnqfEx+bDnMQVTty3tPvUtEuV9ZveAb8yhcOH42+jUnzD oex7u7geZvio5mnO3Spw3UJul59wqv7oiqNa37b9ISi4GhRzt8ah9bxKElQw5Ijx+We6 r/yWv7PlDB89lB5gyWKzKaSoL1/CL/LdnQjZm5FC7FG31yXQ0DewldE4EWajmIIdUitk +ZJg== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m184-20020a633fc1000000b0046eb0e2db57si1644200pga.518.2022.11.10.23.13.14; Thu, 10 Nov 2022 23:13:27 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233151AbiKKHJN (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Fri, 11 Nov 2022 02:09:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233202AbiKKHJB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Nov 2022 02:09:01 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F240716E7; Thu, 10 Nov 2022 23:08:53 -0800 (PST) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N7qYb4FdjzmVGh; Fri, 11 Nov 2022 15:08:35 +0800 (CST) Received: from localhost.localdomain (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 11 Nov 2022 15:08:50 +0800 From: Ziyang Xuan <william.xuanziyang@huawei.com> To: <vburru@marvell.com>, <aayarekar@marvell.com>, <sburla@marvell.com>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH net 2/4] octeon_ep: ensure octep_get_link_status() successfully before octep_link_up() Date: Fri, 11 Nov 2022 15:08:47 +0800 Message-ID: <7e653ae15e1368ff33435da7c6df94d5e5d4fad0.1668150074.git.william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1668150074.git.william.xuanziyang@huawei.com> References: <cover.1668150074.git.william.xuanziyang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749182901150760502?= X-GMAIL-MSGID: =?utf-8?q?1749182901150760502?= |
Series |
octeon_ep: fix several bugs in exception paths
|
|
Commit Message
Ziyang Xuan
Nov. 11, 2022, 7:08 a.m. UTC
octep_get_link_status() can fail because send mbox message failed, then
octep_get_link_status() will return ret less than 0. Excute octep_link_up()
as long as ret is not equal to 0 in octep_open() now. That is not correct.
The value type of link.state is enum octep_ctrl_net_state. Positive value
represents up. Excute octep_link_up() when ret is bigger than 0.
Fixes: 862cd659a6fb ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 7985a748fafe..546bcebf4462 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -521,7 +521,7 @@ static int octep_open(struct net_device *netdev) octep_oq_dbell_init(oct); ret = octep_get_link_status(oct); - if (ret) + if (ret > 0) octep_link_up(netdev); return 0;