Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp227682pxb; Thu, 12 Nov 2020 02:07:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5ELQjhWYSMeQ3VMjNKEH7jKOkV8mq5np3TAAJSGXnnO8w3RlEhK9zwK41ThyiucPoVxq2 X-Received: by 2002:a05:6402:54d:: with SMTP id i13mr4458283edx.3.1605175678391; Thu, 12 Nov 2020 02:07:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605175678; cv=none; d=google.com; s=arc-20160816; b=ZkcCpqMW/U4WUiy8pbtL+Dqci8B4Z8fw6Q+R18sJAc6+N8VRSg7Y2mRdhOzxPifkJv O6TlZYwRWgNtgqv4wm4E4v/BSa7m1F2LzDFoY1q010kGj1NcXBaljAKo622paTeZn9pM Cp2tzgIlQe0vNthh5bI9f1BzK8sley68bjTcXE8jrLxXsCMR6Z3hp5DjYVnZBbHQzmad HPo1NYPsSn8EJcAFW7uZGT4UdPNctxrxEJFLv0VQbLK2I2kCKPNufeEaPyj/YKiJ813n iYkGVnYpe/qY3HAntHtHdr/cHs1bt8vFtMFwT8nmU37WcApHLbySvkT40Qh47jW1RDxU eyog== 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 :cc:to:subject:dkim-signature; bh=5mZL0qdohem3qi1lEyWOIBg12nManBREU6hV9hbnWsQ=; b=Sa1R4AXd27MVpif1zVysMguo/G3cpuhsHUVDwgitIWDNfq7hvlguLCViyZvUAu7wqr qZVYbW1/7JnNYf8qxxIgsD8HijbnN1bAqBKC6PLZdtr/M11bIvK5iiI78lDzHwG1XpvW KVCOvVtMUH/FzxiFhd9xLglw7xouNb0qjrCgsZy7LW/dW8DrcW3oSZjiireBTZGAOJFB Zy8j+skgqHiwN0jHalMJReN4DFptlnhFPazBOegXLCCf2b95Mrkiu5XD5ei/az1NGAx+ JMqbGqRbWXqXTRpwitFqMR4i/AH7U3D1OdkCBpZZuNxUkQrkBkaJ+JJk+H3MYcDjhzoV RVmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oqzUHMsW; 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 a10si3643178eda.423.2020.11.12.02.07.35; Thu, 12 Nov 2020 02:07:58 -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=oqzUHMsW; 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 S1727822AbgKLKFh (ORCPT + 99 others); Thu, 12 Nov 2020 05:05:37 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:45284 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725979AbgKLKFg (ORCPT ); Thu, 12 Nov 2020 05:05:36 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0ACA5GcC118916; Thu, 12 Nov 2020 04:05:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605175516; bh=5mZL0qdohem3qi1lEyWOIBg12nManBREU6hV9hbnWsQ=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=oqzUHMsWgArLmS3nkD989pi4ORqwqz0Bwahk2/PFCk1/fcYauWXSgCuOSqgyv/Vt2 vP5ZiYdIlndaZNqV+9WLwiLvw3pjPksdJiPwswFCHMUcUsI9fwTGoSUKF0/7aJ4R1X 0viBU2OcfGbZtb+5R/LaSgDQGiW1yXXgCROGZQJo= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0ACA5Guh082266 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Nov 2020 04:05:16 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 12 Nov 2020 04:05:16 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE105.ent.ti.com (157.170.170.35) 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; Thu, 12 Nov 2020 04:05:16 -0600 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0ACA5Eea013120; Thu, 12 Nov 2020 04:05:14 -0600 Subject: Re: [PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR To: Arnd Bergmann , =?UTF-8?B?546L5pOO?= CC: Jakub Kicinski , Richard Cochran , "David S. Miller" , Samuel Zou , Kurt Kanzenbach , Ivan Khoronzhuk , Networking , "linux-kernel@vger.kernel.org" References: <20201111080027.7830f756@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Grygorii Strashko Message-ID: <64177a8e-eb60-bc27-6d64-26234be47601@ti.com> Date: Thu, 12 Nov 2020 12:05:25 +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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/2020 10:25, Arnd Bergmann wrote: > On Thu, Nov 12, 2020 at 2:48 AM 王擎 wrote: >>>> On Wed, Nov 11, 2020 at 03:24:33PM +0200, Grygorii Strashko wrote: >>> >>> I don't think v1 builds cleanly folks (not 100% sure, cpts is not >>> compiled on x86): >>> >>> ret = cpts->ptp_clock ? cpts->ptp_clock : (-ENODEV); >>> >>> ptp_clock is a pointer, ret is an integer, right? >> >> yeah, I will modify like: ret = cpts->ptp_clock ? PTR_ERR(cpts->ptp_clock) : -ENODEV; > > This is not really getting any better. If Richard is worried about > Kconfig getting changed here, I would suggest handling the > case of PTP being disabled by returning an error early on in the > function, like > > struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, > struct device_node *node) > { > struct am65_cpts *cpts; > int ret, i; > > if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK)) > return -ENODEV; > > Then you can replace the broken IS_ERR_OR_NULL() path with > a simpler IS_ERR() case and keep the rest of the function readable. There is proper blocker in am65-cpts.h #if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS) and in Makefile and proper dependency in Kconfig. config TI_K3_AM65_CPTS tristate "TI K3 AM65x CPTS" depends on ARCH_K3 && OF depends on PTP_1588_CLOCK But, as Richard mentioned [1], ptp_clock_register() may return NULL even if PTP_1588_CLOCK=y (which I can't confirm neither deny - from the fast look at ptp_clock_register() code it seems should not return NULL) > >>> Grygorii, would you mind sending a correct patch in so Wang Qing can >>> see how it's done? I've been asking for a fixes tag multiple times >>> already :( >> >> I still don't quite understand what a fixes tag means, >> can you tell me how to do this, thanks. > > This identifies which patch introduced the problem you are fixing > originally. If you add an alias in your ~/.gitconfig such as > > [alias] > fixes = show --format='Fixes: %h (\"%s\")' -s > > then running > > $ git fixes f6bd59526c > produces this line: > > Fixes: f6bd59526ca5 ("net: ethernet: ti: introduce am654 common > platform time sync driver") correct > > which you can add to the changelog, just above the Signed-off-by > lines. [1] https://lore.kernel.org/patchwork/patch/1334067/#1529232 -- Best regards, grygorii