Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263AbdHNHOu (ORCPT ); Mon, 14 Aug 2017 03:14:50 -0400 Received: from mail-cys01nam02on0052.outbound.protection.outlook.com ([104.47.37.52]:25600 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751459AbdHNHOs (ORCPT ); Mon, 14 Aug 2017 03:14:48 -0400 Date: Mon, 14 Aug 2017 00:14:34 -0700 From: Felix Manlunas To: "Gustavo A. R. Silva" Cc: Derek Chickles , Satanand Burla , Raghu Vatsavayi , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] liquidio: fix duplicated code for different branches Message-ID: <20170814071434.GA1046@felix-thinkpad.cavium.com> References: <20170813013855.GA6686@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170813013855.GA6686@embeddedgus> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [73.71.186.126] X-ClientProxiedBy: MWHPR11CA0003.namprd11.prod.outlook.com (10.172.48.141) To CY4PR07MB3174.namprd07.prod.outlook.com (10.172.115.140) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 583ad63a-34fc-4d5f-25c7-08d4e2e42508 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR07MB3174; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB3174;3:k+iO7bb0IrkgZWeEsFoEyo982AvK5eSDlq4Lgdy2Lx8m/FrxyF5k+dG9zNHMcKL+TgXryBcuqPMgF6j0yvGxEr+2NzhJdFeTjCmvOaJV5ZbkXfPnbq7mEHr0eA63dJw/8Xm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OY2y2hv2u72yfr8e9zyOYUtFoskNyM5OrChIevzXfN7TwI3q3svhJTX2JxyMdejsU5MWISgwQWV6TIfe930pHP5mQdEKLcl9UdpImrCLpCUkCZiNa4Nj6qjkd2m6+eXLfZU+/diKgxy9F0H7yfLK+ZhX09VYFVrrEeA1rctReM8WRvtBAKQSFf3iI7H48XDP0dftpnMo54c5sZ4iZ;4:hGSPiPkZbRx5QBAiNBCP47rZdGbgXTGotLN/E0OOSoEPrsXNWOWgSyvEh0+Ug1j4pQgE2wLzyqzBRzBMCx3lvuzkCMXFDdBTCzVfUhhxZE2t1I7Q0SAzxtgOLgT0GEIaiqEEiw/rzEufzSR6qrUdnBxRQXjzDLU1abc0oHuSTMHiM3vg2ai/03v6y+p6lRUI3ewerdeHr/HMAg9QVTFb5whjDIIR+5axEJwpDzYJmZghqKdZxQxOyF7Ct0wwXetF X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR07MB3174;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR07MB3174; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6069001)(6009001)(199003)(189002)(24454002)(68736007)(6496005)(7350300001)(6246003)(105586002)(6486002)(47776003)(66066001)(8676002)(110136004)(6666003)(23726003)(86362001)(83506001)(4001350100001)(1076002)(106356001)(76506005)(478600001)(2906002)(6916009)(54906002)(53936002)(2950100002)(4326008)(305945005)(72206003)(6116002)(50466002)(189998001)(33656002)(3846002)(229853002)(5660300001)(101416001)(50986999)(54356999)(7736002)(76176999)(97736004)(42186005)(25786009)(81166006)(81156014)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB3174;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Felix.Manlunas@cavium.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB3174;23:zofZBXDFsm7wCbNb8dxOgYw+Y9OvCK268fxhnF7Ss?= =?us-ascii?Q?Y4lDDGbZIBQ3fB477HQ2bU34pXWg8EJRyvieAlQzGiyOQdgTUDFtpBQeI1sY?= =?us-ascii?Q?W8P5QOaeWAybjmKtAQ+nKycM2hBOi/dmMvkAKDfTkOCOQbzL0jtmf/I3u+wp?= =?us-ascii?Q?DaqU7l/g6ZwHpPdDkJuOtNqciwks3a0Ap501cl122qeNSnxGIFiphJzZyTD6?= =?us-ascii?Q?87FwshCn/pOLSgf+ILqv/Tv83sL5uEh3XkDMmdh0Xp3wWvpjnn1EEgoABw8d?= =?us-ascii?Q?h8OfKG5rqChahMyO2TzBsXci332FL30l4fnLidBc8K0Ov9+96PVV3IeZWYIy?= =?us-ascii?Q?2fYI/hzAOuUW6nbEIKwIJoLRe+8+GEDmUjMcg1rPz0aegudPdxsV/oyNhu+f?= =?us-ascii?Q?kbkJXLjZeGqBXLj8lz2LVJB2Zzvzf2Sxw1J8c6tVdmt4npiUTaoKJX6uo3xK?= =?us-ascii?Q?N8BPip0qteLcWd66cxIq9tPMBpaaHtJq+ijiUxiRT29HCq2+ER/6eeyw9diJ?= =?us-ascii?Q?GTj6VQTazZrvp9LXQ+wI4ATirSAL1l5tNCh0F0xkEbLQE3B7p75P61Hk9ece?= =?us-ascii?Q?fpF9GgSzs3LTWoQOjCS7YuMd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CaVtdD+QyIPIqY5tIdq+L8h/Ht4sGjjovya7EYnB4XqtiTzchP21hvy952I7pu3Elra7UUcFTH82WscpdJEWGCXZ/ySUxs0+s/nqw2EJfh5e+hlG9SCA==;5:8Xtm2TRtQDKQ/HOBhfD3EIYby3o8ygghuY4NDU9rFBRJhn8DoCDdGUJ31YLdKHxhem4z9RDVM+KmetCfpXK9wMVbSD6fLfWkC5/+I0oYn4nuNqJ8FBoH1y5uoJde33x2JQW5xj62GD+DI67cUXrqRw==;24:fPPW+5tplH8D3U4m6Fc/KH8X/1c76IueERIdqncfZ/yRs9PRov8RLgRfAWeE3662R7jqrTduwQaxfHXoC1oWq10PA4P91D86JVTbjDFaSxM=;7:PnqVCBZXEGqJZKMoK4gQwzG7dNQL+bER0EHzXI6ScoBp/FgAVRBJRzJVUrsUNhnYwAOI3sBJa9ZNku9/U24AhXin2dbS9dZZwNVMPcbR2EVdvpufms9RaGzEAJ8KD3Dh8IWIU5EkrulvLiRq5/ix45kSRiiTxYJhimd76qJLXVj+yrNpKVxw7h58AwhfefDCdlp55s0xbKSLoDS+B7DmV0FgfR7HRexBOSna0qOk5B0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 07:14:46.5919 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3174 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1478 Lines: 48 On Sat, Aug 12, 2017 at 08:38:55PM -0500, Gustavo A. R. Silva wrote: > Refactor code in order to avoid identical code for different branches. > > This issue was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva > --- > This code was tested by compilation only. > > drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c > index b78e296..4f65c08 100644 > --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c > +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c > @@ -578,23 +578,18 @@ static int lio_set_phys_id(struct net_device *netdev, > break; > > case ETHTOOL_ID_ON: > - if (oct->chip_id == OCTEON_CN66XX) { > + if (oct->chip_id == OCTEON_CN66XX) > octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG, > VITESSE_PHY_GPIO_HIGH); > - > - } else if (oct->chip_id == OCTEON_CN68XX) { > - return -EINVAL; > - } else { > + else > return -EINVAL; > - } > + > break; > > case ETHTOOL_ID_OFF: > if (oct->chip_id == OCTEON_CN66XX) > octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG, > VITESSE_PHY_GPIO_LOW); > - else if (oct->chip_id == OCTEON_CN68XX) > - return -EINVAL; > else > return -EINVAL; > > -- > 2.5.0 > Acked-by: Felix Manlunas