From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A51C48BE5 for ; Wed, 16 Jun 2021 13:29:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30BEB61241 for ; Wed, 16 Jun 2021 13:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232912AbhFPNbS (ORCPT ); Wed, 16 Jun 2021 09:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbhFPNbP (ORCPT ); Wed, 16 Jun 2021 09:31:15 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4C92C061574; Wed, 16 Jun 2021 06:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eV9wlaJRtH6xgA6NpxWOpKQTk5aIanp5IHRWCYIODGA=; b=ItNfW2usIA0QybWdB9nm+9frE CYTWyLkj+0HBDYNR/94lmFjpWew8IuY77Iat62zdub4KMpevVKeD2wbFK/nMxZ3b6PBnK6J8eIjKx ZKOnZnCVG1PEQLlsZOVog+NkC8L6jiT1tZntlfZqrsrn2zFnKaYM3haM1WThTps/oXXUkX4qD68tG e84yXwQsEMzwepnbZnC088WRZc5h1zr6+nQFWdXhtdrGcX+znHP1U/ySzfbRZTdSrJY489ElfblKB gfrXzBnxrHNKD1RTs+6+8Y+mrnbEirBdJj3jSSZjbPc6vCey7O69lYRuFxeiyDlva1lY24Qga22/q Hmvj1Xb/Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45068) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltVbK-0007Gk-P7; Wed, 16 Jun 2021 14:29:02 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1ltVbH-000645-PM; Wed, 16 Jun 2021 14:28:59 +0100 Date: Wed, 16 Jun 2021 14:28:59 +0100 From: "Russell King (Oracle)" To: Joakim Zhang Cc: "davem@davemloft.net" , "kuba@kernel.org" , "peppe.cavallaro@st.com" , "alexandre.torgue@foss.st.com" , "joabreu@synopsys.com" , "mcoquelin.stm32@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , dl-linux-imx Subject: Re: [PATCH net 1/2] net: fec_ptp: add clock rate zero check Message-ID: <20210616132859.GE22278@shell.armlinux.org.uk> References: <20210616091426.13694-1-qiangqing.zhang@nxp.com> <20210616091426.13694-2-qiangqing.zhang@nxp.com> <20210616102038.GB22278@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joakim, On Wed, Jun 16, 2021 at 11:40:29AM +0000, Joakim Zhang wrote: > Do you mean that print an error message then return directly? It seems better. Nearly - one has to ensure that the cleanup functions don't provoke a crash though. I notice fec_ptp_stop() makes use of fep->time_keep and also fep->ptp_clock. fep->time_keep is initialised after where you need to test for zero cycle_speed, so the initialisation would need moving earlier. I would have thought that ftp->ptp_clock should be NULL, so that's probably okay, but should be checked that this assumption is in fact true. > if (!fep->cycle_speed) { > dev_err(&fep->pdev->dev, "PTP clock rate should not be zero!\n"); I'd still say something like "PTP clock rate should not be zero, disabling PTP" - say what's wrong and what we are doing. Also, please avoid exclaimation marks in error messages. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C5AFC48BE6 for ; Wed, 16 Jun 2021 13:30:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4D0561166 for ; Wed, 16 Jun 2021 13:30:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4D0561166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p5X+6OwTmObP2iB8qOgqcuvPV8UoD5E0nWnHdY4jGrw=; b=jwONkZJE3+EY/1 l6NfpYOXPb5gjm+Xjmjnfne/rlU4rlnyyHJnvkojy/VrxnKtm6Hxg06hSlLo+jKexxMseoJXEWKzJ GiXdq+UH81gqfKZqAunJbxRnRGdqidVRj4wzpK/CyMSabbME+EomruMb3WN6ti3Kw1wEKrJcrasPY 7hYPfu7bemzn5WZZCaxsETbMjrf3hyidG3Uf9m/voKd0MXXoPc6m/Qc6woPldOqLF4aSU52wjGwQz P8oVGeoN3GdSXYR40zJ+6w4VnpInzU+gNvWXH4u1bx6n5z0jUCdC6GhxwgH/A0Ozxm23Y+GF67jPj rSQIOcnpqEo6BGu5akrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltVbX-006Q3L-Cb; Wed, 16 Jun 2021 13:29:15 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltVbT-006Q2H-0s for linux-arm-kernel@lists.infradead.org; Wed, 16 Jun 2021 13:29:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eV9wlaJRtH6xgA6NpxWOpKQTk5aIanp5IHRWCYIODGA=; b=ItNfW2usIA0QybWdB9nm+9frE CYTWyLkj+0HBDYNR/94lmFjpWew8IuY77Iat62zdub4KMpevVKeD2wbFK/nMxZ3b6PBnK6J8eIjKx ZKOnZnCVG1PEQLlsZOVog+NkC8L6jiT1tZntlfZqrsrn2zFnKaYM3haM1WThTps/oXXUkX4qD68tG e84yXwQsEMzwepnbZnC088WRZc5h1zr6+nQFWdXhtdrGcX+znHP1U/ySzfbRZTdSrJY489ElfblKB gfrXzBnxrHNKD1RTs+6+8Y+mrnbEirBdJj3jSSZjbPc6vCey7O69lYRuFxeiyDlva1lY24Qga22/q Hmvj1Xb/Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:45068) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltVbK-0007Gk-P7; Wed, 16 Jun 2021 14:29:02 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1ltVbH-000645-PM; Wed, 16 Jun 2021 14:28:59 +0100 Date: Wed, 16 Jun 2021 14:28:59 +0100 From: "Russell King (Oracle)" To: Joakim Zhang Cc: "davem@davemloft.net" , "kuba@kernel.org" , "peppe.cavallaro@st.com" , "alexandre.torgue@foss.st.com" , "joabreu@synopsys.com" , "mcoquelin.stm32@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , dl-linux-imx Subject: Re: [PATCH net 1/2] net: fec_ptp: add clock rate zero check Message-ID: <20210616132859.GE22278@shell.armlinux.org.uk> References: <20210616091426.13694-1-qiangqing.zhang@nxp.com> <20210616091426.13694-2-qiangqing.zhang@nxp.com> <20210616102038.GB22278@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210616_062911_109885_DEAC46BA X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Joakim, On Wed, Jun 16, 2021 at 11:40:29AM +0000, Joakim Zhang wrote: > Do you mean that print an error message then return directly? It seems better. Nearly - one has to ensure that the cleanup functions don't provoke a crash though. I notice fec_ptp_stop() makes use of fep->time_keep and also fep->ptp_clock. fep->time_keep is initialised after where you need to test for zero cycle_speed, so the initialisation would need moving earlier. I would have thought that ftp->ptp_clock should be NULL, so that's probably okay, but should be checked that this assumption is in fact true. > if (!fep->cycle_speed) { > dev_err(&fep->pdev->dev, "PTP clock rate should not be zero!\n"); I'd still say something like "PTP clock rate should not be zero, disabling PTP" - say what's wrong and what we are doing. Also, please avoid exclaimation marks in error messages. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel