Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1196690pxb; Fri, 6 Nov 2020 03:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqmLjG7ZU6VWk0KnkXDUKfKfsHEesSoLzhHSNO8f/8LUH7Bi8xAfJ1T/l2hLaq5Mr7xnOx X-Received: by 2002:a17:906:b104:: with SMTP id u4mr1530119ejy.121.1604662700964; Fri, 06 Nov 2020 03:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604662700; cv=none; d=google.com; s=arc-20160816; b=Wx8WE+g4OhZwTxmW5NgnyQsP2Qyf4kGJfA+l2a90wGtIvCA6G080w+2HaK3Nk6N24g 0Y68J9UZhyZlwK2ISBhHmcPQvLnW6/PyST7a/tb8yxLlZATZhfFrsgG6pE6vKrobJCWi mc8TMw5sC3LKxMPm2KiIyRBa8+qNLb3wP8+YO/2WhZcEwvz5+Y8WWriifD2potl0iB0m O15iiYXyPysRvNUX10FGtbuGn+kA5O1R0AyefwU8FSPJmxNMrBcx7u6DYxNrHA2bODaq KPl4JVa+xiPML8Tr3SkKBqleB/BxF4D6xz79YTCEC5O2Zc6WHBTtygGW/dz3DMMSQOfF XbWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=DcQpD/+WVWEG8zUZCk/U6AoWPUg3QwRD4/zJ7DpRABA=; b=W5F1uyUKBixHMPdzZMOjWcJJ84wRRJ+PDwSW8Z3jszF7P8Z4LL4Fb6GfmW8+Hvilj2 q0hOWh9MM/fJ8rh2N6m5T+QznHrvpSZ3sBd7SpcN6vhsEW+ngWhXz0O3DR9goaCYgpsQ BP8u1xlSnQe7VrzvohDRj+QG5DnkepYPjnNj+Iqt4AaDtvyRmRNhIU6c8Bgxz3EKFday Fj/ZUmP6hEmVnxXGex45ii0HhQOEnGsg5ca6VsOOmBungKYmfw0H3e4A0EYqaUbVA4ay moLvE/5aBe9F4zzO2mraVA9jLr97rTQYy5wAzlcOSr+xDfaPKwF4Fo2ibf9cwqff5DK1 1/YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Tcg+Vtw1; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si664682edj.250.2020.11.06.03.37.49; Fri, 06 Nov 2020 03:38:20 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Tcg+Vtw1; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbgKFLeZ (ORCPT + 99 others); Fri, 6 Nov 2020 06:34:25 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:39670 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbgKFLeX (ORCPT ); Fri, 6 Nov 2020 06:34:23 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0A6BXrpT076586; Fri, 6 Nov 2020 05:33:54 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1604662434; bh=DcQpD/+WVWEG8zUZCk/U6AoWPUg3QwRD4/zJ7DpRABA=; h=Subject:To:References:From:Date:In-Reply-To; b=Tcg+Vtw1XcBAGyHpmM5ODdc7C/XQ8UsBEX8CLXtl5BAWv+FJvK15YMV43NEx6kHWp pKXDEyYeRnpJdAKhJUsu0StbhAMrupaRZiIXgn7nzZCpdprUK7cVnzDzxJMZ/dtfbH jHemuLSH2N/fOMHIoo4TqOznKjdawLR5U13eIG4U= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0A6BXrGr058656 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 6 Nov 2020 05:33:53 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 6 Nov 2020 05:33:53 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 6 Nov 2020 05:33:53 -0600 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0A6BXoea087317; Fri, 6 Nov 2020 05:33:51 -0600 Subject: Re: [PATCH] net/ethernet: update ret when ptp_clock is ERROR To: Wang Qing , "David S. Miller" , Jakub Kicinski , Samuel Zou , Kurt Kanzenbach , Richard Cochran , , References: <1604649411-24886-1-git-send-email-wangqing@vivo.com> From: Grygorii Strashko Message-ID: Date: Fri, 6 Nov 2020 13:34:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1604649411-24886-1-git-send-email-wangqing@vivo.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2020 09:56, Wang Qing wrote: > 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, there is cpts->ptp_clock = ptp_clock_register(&cpts->ptp_info, cpts->dev); > if (IS_ERR_OR_NULL(cpts->ptp_clock)) { And ptp_clock_register() can return NULL only if PTP support is disabled. In which case, we should not even get here. So, I'd propose to s/IS_ERR_OR_NULL/IS_ERR above, and just assign ret = PTR_ERR(cpts->ptp_clock) here. > 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); > -- Best regards, grygorii