Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp210312pxb; Wed, 11 Nov 2020 01:27:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVajgLYaGRkHTIZY7hxiNlwx9XpA11GduFwB+RN3VEujFByUWCX+BpAXjAJiJ8u0A37mIq X-Received: by 2002:a17:906:f8c5:: with SMTP id lh5mr15652996ejb.77.1605086833864; Wed, 11 Nov 2020 01:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605086833; cv=none; d=google.com; s=arc-20160816; b=S3tU1nbzM6w6okABQHdkXQiJI0Wjm9FtHohQWxjY0jaKZ8bk4b9r3iOmR9dzGV15BO Ir3Yt7VZITkJhZhBOBZvNnmi8TX67vyY1uUtB4i2pnpF6/2q74ZzQi7K9CkM3W71WOBM w/7Kc3MKvMl67j9Rn0udJsReEax3D7EXEQvFzCFLwKMhrGufMCZbzcR4xeLk1OGjSJwC d7zDHFQf4/Br94ovufuPDvIFMcof6bjunLJ3ofMJA6Se4IlQ467xGXte6aN4fknJqXP8 lgLnAWH+0lnJZSpYYCgh1+lpXISJGn0vMGquCNCHRzFmMrm2OQ6+wRfNX9XxosJ9TIt8 qTBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=ydO2dVzPLiqDYvOxxc3jEWWIn1e9byzS4dnnGNDDI8w=; b=F5kI97NpY+hbdUySX7ipa6okT0FAiAwaDaZSWdPxiqRxy2wZp/MmPNfhUnXJAPNR+R aZ37iFfbfKDjXUTE83xLs7q3UNaLukOH+Ml/SFCJ8kBLlXIBFmZA4XrbmfJKylcxQ3k1 B1zqGyEje5xInQGvQhyAv3OpL2rmVRlyDQpeBe0S4Pp0La3yIIXBHhY52hjVKwqGIWCo jNtqoX2/lV67HwdM708M7vB6/sAyoKc5JS6rFQrS5b7GpWuAtNzUmsiUQ50bIqmhI84R l5pas0javeMJt1mQsyVrDdaN41qDDsQ0y8Mh0Sy8BlwkavQzOKOi1g1oqmlHk3onRLQt 7nmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si916584ejr.184.2020.11.11.01.26.49; Wed, 11 Nov 2020 01:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726449AbgKKJZF (ORCPT + 99 others); Wed, 11 Nov 2020 04:25:05 -0500 Received: from mail-m1271.qiye.163.com ([115.236.127.1]:62822 "EHLO mail-m1271.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbgKKJZE (ORCPT ); Wed, 11 Nov 2020 04:25:04 -0500 Received: from vivo-HP-ProDesk-680-G4-PCI-MT.vivo.xyz (unknown [58.251.74.231]) by mail-m1271.qiye.163.com (Hmail) with ESMTPA id 9896A582895; Wed, 11 Nov 2020 17:25:01 +0800 (CST) From: Wang Qing To: "David S. Miller" , Jakub Kicinski , Grygorii Strashko , Samuel Zou , Kurt Kanzenbach , Murali Karicheri , Ivan Khoronzhuk , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: richardcochran@gmail.com, Wang Qing Subject: [PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR Date: Wed, 11 Nov 2020 17:24:41 +0800 Message-Id: <1605086686-5140-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZTx0dGBhJQ0tPT0pIVkpNS05LQ01MS0lJSEpVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS09ISVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NxA6Dzo6Sz8qHRcSIhlIHD8W NzZPCTJVSlVKTUtOS0NNTEtJTUxKVTMWGhIXVQwaFRwKEhUcOw0SDRRVGBQWRVlXWRILWUFZTkNV SU5KVUxPVUlISllXWQgBWUFJSkNONwY+ X-HM-Tid: 0a75b69f69f898b6kuuu9896a582895 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We always have to update the value of ret, otherwise the error value may be the previous one. And ptp_clock_register() never return NULL when PTP_1588_CLOCK enable. Signed-off-by: Wang Qing --- drivers/net/ethernet/ti/am65-cpts.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c index 75056c1..b319d45 --- a/drivers/net/ethernet/ti/am65-cpts.c +++ b/drivers/net/ethernet/ti/am65-cpts.c @@ -1001,8 +1001,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, if (IS_ERR_OR_NULL(cpts->ptp_clock)) { dev_err(dev, "Failed to register ptp clk %ld\n", PTR_ERR(cpts->ptp_clock)); - if (!cpts->ptp_clock) - ret = -ENODEV; + ret = PTR_ERR(cpts->ptp_clock); goto refclk_disable; } cpts->phc_index = ptp_clock_index(cpts->ptp_clock); -- 2.7.4