Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752498AbdLGTtF (ORCPT ); Thu, 7 Dec 2017 14:49:05 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:38006 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752325AbdLGTtB (ORCPT ); Thu, 7 Dec 2017 14:49:01 -0500 X-Google-Smtp-Source: AGs4zMaz97PoELH6WQ0b45RViedReZwujy2Uz+xsy6SWdVFMXv+feVfX0d4br+sKYNZCh/Zyui1T8A== Date: Thu, 7 Dec 2017 21:48:56 +0200 From: Ivan Khoronzhuk To: David Miller Cc: grygorii.strashko@ti.com, netdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: ethernet: ti: cpdma: rate is not changed - correct case Message-ID: <20171207194855.GA3022@khorivan> Mail-Followup-To: David Miller , grygorii.strashko@ti.com, netdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org References: <1512571278-13196-1-git-send-email-ivan.khoronzhuk@linaro.org> <20171206.163545.906490902377440615.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171206.163545.906490902377440615.davem@davemloft.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1359 Lines: 37 On Wed, Dec 06, 2017 at 04:35:45PM -0500, David Miller wrote: > From: Ivan Khoronzhuk > Date: Wed, 6 Dec 2017 16:41:18 +0200 > > > If rate is the same as set it's correct case. > > > > Signed-off-by: Ivan Khoronzhuk > > --- > > Based on net-next/master > > > > drivers/net/ethernet/ti/davinci_cpdma.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c > > index e4d6edf..dbe9167 100644 > > --- a/drivers/net/ethernet/ti/davinci_cpdma.c > > +++ b/drivers/net/ethernet/ti/davinci_cpdma.c > > @@ -841,7 +841,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate) > > return -EINVAL; > > > > if (ch->rate == rate) > > - return rate; > > + return 0; > > Looking at the one and only caller of this function, cpsw_ndo_set_tx_maxrate, it > makes sure this can never, ever, happen. In current circumstances yes, it will never happen. But I caught it while adding related code and better return 0 if upper caller doesn't have such check. Suppose that cpdma module is responsible for itself and if it's critical I can send this patch along with whole related series. > > So I would instead remove this check completely since it can never trigger. -- Regards, Ivan Khoronzhuk