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 60C01C43334 for ; Wed, 6 Jul 2022 01:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbiGFBds (ORCPT ); Tue, 5 Jul 2022 21:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiGFBdp (ORCPT ); Tue, 5 Jul 2022 21:33:45 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 934D61166 for ; Tue, 5 Jul 2022 18:33:43 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ld27S35BMzhYyS; Wed, 6 Jul 2022 09:31:16 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 6 Jul 2022 09:33:34 +0800 Received: from [10.174.178.174] (10.174.178.174) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 6 Jul 2022 09:33:33 +0800 Subject: Re: [PATCH -next 2/2] xtensa: iss: change the return type of iss_net_configure() to void To: Max Filippov CC: LKML , "open list:TENSILICA XTENSA PORT (xtensa)" , Chris Zankel References: <20220705132032.702972-1-yangyingliang@huawei.com> <20220705132032.702972-2-yangyingliang@huawei.com> From: Yang Yingliang Message-ID: <87706ab7-29d3-b56b-2912-70c6ad7d28cc@huawei.com> Date: Wed, 6 Jul 2022 09:33:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.178.174] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2022/7/5 23:59, Max Filippov wrote: > Hi Yang, > > On Tue, Jul 5, 2022 at 6:10 AM Yang Yingliang wrote: >> Change the return type of iss_net_configure() to void, because it's not used. >> >> Signed-off-by: Yang Yingliang >> --- >> arch/xtensa/platforms/iss/network.c | 23 +++++++++-------------- >> 1 file changed, 9 insertions(+), 14 deletions(-) > This change removes a lot of code that was added in the previous change. > Maybe fold both patches into one to avoid that pattern of adding and then > immediately removing code? Or, if you feel that changing the return type > of the iss_net_configure is an important separate step, maybe do it first? I will send a v2 with these changes in one patch. Thanks, Yang > >> diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c >> index 5e475f7472e4..e38ff51ce833 100644 >> --- a/arch/xtensa/platforms/iss/network.c >> +++ b/arch/xtensa/platforms/iss/network.c >> @@ -472,16 +472,15 @@ static const struct net_device_ops iss_netdev_ops = { >> .ndo_set_rx_mode = iss_net_set_multicast_list, >> }; >> >> -static int iss_net_configure(int index, char *init) >> +static void iss_net_configure(int index, char *init) >> { >> struct net_device *dev; >> struct iss_net_private *lp; >> - int err; >> >> dev = alloc_etherdev(sizeof(*lp)); >> if (dev == NULL) { >> pr_err("eth_configure: failed to allocate device\n"); >> - return -ENOMEM; >> + return; >> } >> >> /* Initialize private element. */ >> @@ -509,7 +508,6 @@ static int iss_net_configure(int index, char *init) >> if (!tuntap_probe(lp, index, init)) { >> pr_err("%s: invalid arguments. Skipping device!\n", >> dev->name); >> - err = -EINVAL; >> goto err_free_netdev; >> } >> >> @@ -518,8 +516,7 @@ static int iss_net_configure(int index, char *init) >> /* sysfs register */ >> >> if (!driver_registered) { >> - err = platform_driver_register(&iss_net_driver); >> - if (err) >> + if (platform_driver_register(&iss_net_driver)) >> goto err_free_netdev; >> driver_registered = 1; >> } >> @@ -530,8 +527,7 @@ static int iss_net_configure(int index, char *init) >> >> lp->pdev.id = index; >> lp->pdev.name = DRIVER_NAME; >> - err = platform_device_register(&lp->pdev); >> - if (err) >> + if (platform_device_register(&lp->pdev)) >> goto err_free_netdev; >> SET_NETDEV_DEV(dev, &lp->pdev.dev); >> >> @@ -541,23 +537,22 @@ static int iss_net_configure(int index, char *init) >> dev->irq = -1; >> >> rtnl_lock(); >> - err = register_netdevice(dev); >> - rtnl_unlock(); >> - >> - if (err) { >> + if (register_netdevice(dev)) { >> + rtnl_unlock(); >> pr_err("%s: error registering net device!\n", dev->name); >> goto err_unregister_device; >> } >> + rtnl_unlock(); >> >> timer_setup(&lp->tl, iss_net_user_timer_expire, 0); >> >> - return 0; >> + return; >> >> err_unregister_device: >> platform_device_unregister(&lp->pdev); >> err_free_netdev: >> free_netdev(dev); >> - return err; >> + return; > No need for 'return' at the end of the void function. >