Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1764863rwb; Thu, 10 Nov 2022 23:14:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf56T/MAav14LK60SsMyHimdZzQRPN/ebLY0XjsYnr/+Df6CFyMUAc97pLFj96wNBqUeyrKs X-Received: by 2002:a17:903:18c:b0:186:9fc5:6c2c with SMTP id z12-20020a170903018c00b001869fc56c2cmr1203572plg.174.1668150846328; Thu, 10 Nov 2022 23:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668150846; cv=none; d=google.com; s=arc-20160816; b=teGpJUrZOioshFqx/oF96tkyG2oX1IsbdqKxQyQNoqTBWPspSNYfh5R5Cs2JYLMslk N3fzx1UpMkcBqrqOQsZyr4TUGX9QFonYawzimKpfo+y9c/N9w8nLZPeX7sSBdeiuVgyL R9q4CTz9QT0jG2kwNK69sMmTi5JpwuJHDNDs5w2RbFVJrdamzuPo/mcylBEZmLW8Fzyp 7mEeCtFwhxS6Yex+cBnkT7LpZD+AHL+mrnDRLrGg1ZUFP3JYlYRCcz6g/sWjI3JfsB0A 7cNlvZSESDpw1fOwv0JmYLQxk75FXvCjqAB+uAEzFZMRTb8eGqdIgAUSUP+KWWX63HTS OHXA== 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 Return-Path: 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.54; Thu, 10 Nov 2022 23:14:06 -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 + 92 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 ); 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 To: , , , , , , , , 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: References: 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.25.1