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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50939C43217 for ; Mon, 28 Nov 2022 13:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbiK1NfW (ORCPT ); Mon, 28 Nov 2022 08:35:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbiK1NfR (ORCPT ); Mon, 28 Nov 2022 08:35:17 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A8E1EAC0 for ; Mon, 28 Nov 2022 05:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=/xlq2jKirm2n30vYvLD1krTXQIpgjhrn+4CCA31dpKY=; b=qKng43PbLjfET7UzXfgC60SD6O Pm0jEZTecCsA1gH7f6Ro5ncmxxgktw8q2QCrz6KsH7daKc2G+o8YoHhciJ10aVSndXWYYjRwMXoHO xEx1CjXQ+CBXFDQ8WeWLDju34Ra0kMGSpy8ZePjEoQVRnBO/1bTVF8ZwqvBmIwoApcVA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ozeHy-003ejZ-BB; Mon, 28 Nov 2022 14:35:14 +0100 Date: Mon, 28 Nov 2022 14:35:14 +0100 From: Andrew Lunn To: Daniil Tatianin Cc: netdev@vger.kernel.org, Michal Kubecek , yc-core@yandex-team.ru, lvc-project@linuxtesting.org Subject: Re: [PATCH v1 3/3] net/ethtool/ioctl: correct & simplify ethtool_get_phy_stats if checks Message-ID: References: <20221125164913.360082-1-d-tatianin@yandex-team.ru> <20221125164913.360082-4-d-tatianin@yandex-team.ru> <55705e49-4b35-59be-5e41-7454dd12a0a4@yandex-team.ru> <11169dbe-2a26-6f31-3be6-f0439bb861f1@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11169dbe-2a26-6f31-3be6-f0439bb861f1@yandex-team.ru> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > I guess this does indeed look cleaner although I'm not sure about the > duplicated n_stats validation code. Maybe this could be moved to a separate > helper as well or do you think it's okay to duplicate it in this case? Yes, the validation and the memory allocation could be pulled out into a helper. The main thing here is that the code is pretty much identical for the two functions. If one is correct, the other is also correct. There is no access in an else branch which can be overlooked. Andrew