Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1085227pxb; Thu, 5 Nov 2020 23:58:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfPdFj3ggXT8/eYFGW6h0qLxTXOEbjIfqJkPsMa/mKWJVOzdU/rEnboEQ5LBq//z0VRy8T X-Received: by 2002:a50:af21:: with SMTP id g30mr785343edd.46.1604649533023; Thu, 05 Nov 2020 23:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604649533; cv=none; d=google.com; s=arc-20160816; b=yn8GnbtjneQHrjyDx8e70GABBKgh5VW6VW05mPmg7jvTzMrh9WGSzY4PQ29g3cTH1g 5NkD/IDuH8sXfJwAvTXCMTEGWZvic9SjRnWQ4l0mauxXFenatGKYkzBmaa3QvPrGzsvI ZsEbCt5vXME+2lMWTjAC1xYPkuOfHE5Ev/tcgkCf7y4+cU3LOIwD2A5v50cKurzA7To/ 31FyZ2iVVx9E/tzC6tUV6NygOlh4pqNhuH/OuI41OsNBpnlTUvT4UnxVN3k9IIGSy35h IC3IaDE+PCxccxZ5a9MPh7aTSFlfcVvjiNwGwumHy9Ne01PMbpCmdTM7fCekwC1vZVr+ DCEw== 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:to:from; bh=HLqVkP0G8Gp8Unohw993yZiPM8054v7QJn/5aKuMGaM=; b=a4o0GPI6DeQFtKb41yMLhPlmbHJNy8bHsczIpWl/voz6uJ2hj0fsltXSNvWx21Ec9h 1KbKMkP1XcI5oA4HpBA8+tEETA/S0/rgc9M4HZ4Omen6ZqUUsJVckIusYWCRPb9gGUrk W4X2pmhTwwedTAyZLB3acnymsLwyftU/LUcBdPID9w0BexCt2v3uDyrw1Ut8gruEx1wC l65YRqWaDON1UnvqLayritmR0icVRA3JaQz+VhphfzVSOdMmP3kHQfyddnWrxzZi3p3F is/MP2vioSUYj6bF1j5PY6nQN5i8C/boyhIzsSM5RpiUyC472sKfg38AGEl5eqjQkIEM 2vng== 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 bt15si333186ejb.170.2020.11.05.23.58.30; Thu, 05 Nov 2020 23:58:53 -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 S1726540AbgKFH5A (ORCPT + 99 others); Fri, 6 Nov 2020 02:57:00 -0500 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:34733 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbgKFH5A (ORCPT ); Fri, 6 Nov 2020 02:57:00 -0500 X-Greylist: delayed 384 seconds by postgrey-1.27 at vger.kernel.org; Fri, 06 Nov 2020 02:56:59 EST Received: from vivo-HP-ProDesk-680-G4-PCI-MT.vivo.xyz (unknown [58.251.74.231]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id 2488966734C; Fri, 6 Nov 2020 15:56:56 +0800 (CST) From: Wang Qing To: "David S. Miller" , Jakub Kicinski , Grygorii Strashko , Samuel Zou , Kurt Kanzenbach , Wang Qing , Ivan Khoronzhuk , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net/ethernet: update ret when ptp_clock is ERROR Date: Fri, 6 Nov 2020 15:56:45 +0800 Message-Id: <1604649411-24886-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZHhlIQxgaHxhPQ0hDVkpNS09NT0JPSk1MSExVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS09ISVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MBg6NRw*GD8oPx0wNCpMSj5R TyhPChhVSlVKTUtPTU9CT0pMSkpDVTMWGhIXVQwaFRwKEhUcOw0SDRRVGBQWRVlXWRILWUFZTkNV SU5KVUxPVUlISllXWQgBWUFKQk1CNwY+ X-HM-Tid: 0a759c8ef7869373kuws2488966734c 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. 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..b77ff61 --- 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 = cpts->ptp_clock ? cpts->ptp_clock : (-ENODEV); goto refclk_disable; } cpts->phc_index = ptp_clock_index(cpts->ptp_clock); -- 2.7.4