Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1425066imw; Tue, 5 Jul 2022 09:12:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLwn8HRv8m4n3w7Sm9lRUyo69PnnOqHOBZooWxJWwyo4/hV9EInTh3cTMNVVEGVxA2Ndpt X-Received: by 2002:a17:907:7213:b0:726:9f27:8fc8 with SMTP id dr19-20020a170907721300b007269f278fc8mr33928582ejc.523.1657037575502; Tue, 05 Jul 2022 09:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657037575; cv=none; d=google.com; s=arc-20160816; b=qO8N68ZtSbtgotro9iASFE/M1NJR2KoCkJK5vYQfD3lVyYxAGFUcF4SC8lxamabDjJ fk7Qp8abqW/lukNWQHRQtQK1UnopHZkRPxOywxPzAHGFzTHQjtXEwzBtDRly4N5QCs8p z1I9rXtnMGxzrxvptomhtEm8bNVDj9AwdQBfvV/21fgByvJm/gu/SOrV5vNpBoTsjr3O GQ46Bc+ee3JErKPlkYM3mSMdUIQy7uwSfPZP//Q1hzVRBn9pj/VD8bFNNWGYhs/cI3Ll M5t6oDckfDBpNy4eOnHZVy4Ks/Bvfsp9fuNOlSiZPp3KhXOYO93rZ7pH+4ROuNBTUxj/ 6h1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=eVxNdksJTPOevalf7BH9L1TRDCo8ZI9OB7mA3/aAEj8=; b=SRNocHDAa4JA1G9IRWP29EeOJSCJJG25TgROxg5yMwNuN4rRlLpySOgyIBIpK7ANhv YToWJgn7pTK6sE6p4GJg2FD58cs2PnnvllRZrkahNpOgtfVmRu5oiNGvyPv92OF+B7W6 cjqGo/sJVDq40PXxLE6+5C2rPYJmP7wDw6rM+z/abCNrjJSeiuJAcx/5KBzk3jpbPNtr tcbK1ySmTc66Ih5sY3BYpbxsFSloCOmVyYi9fqQgNGzrPqgpihUT5XfXVx27n8pLdyjX uFlzRU09VcyXmRUDzdmLXttDCIa4y9Jpjw9P5PV6CEbMkeyw4hLxzgaxLiwwAiGVsNBf THzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WXZTIBU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr6-20020a1709073f8600b006f40efd4b88si3506317ejc.812.2022.07.05.09.12.30; Tue, 05 Jul 2022 09:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WXZTIBU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232762AbiGEP7s (ORCPT + 99 others); Tue, 5 Jul 2022 11:59:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbiGEP7r (ORCPT ); Tue, 5 Jul 2022 11:59:47 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4246C13DCD for ; Tue, 5 Jul 2022 08:59:46 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id u12so22382275eja.8 for ; Tue, 05 Jul 2022 08:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eVxNdksJTPOevalf7BH9L1TRDCo8ZI9OB7mA3/aAEj8=; b=WXZTIBU9zcO43MUvBFqYfuCH7aGFfk5nMeKMiu6m7yQmfM/t7iOMGon6fEDky+7f0K j3HZhHPUg2BNRBxIXSh/kfJ92zL+0ZCvgF/ySQv4XzgYkHnHz5SRGef43pyzDEhkIDXu SC7UPUw8+zZ2Q+C4zN33YsjGZVo2raTjHfkJ3tbFJCv0t2+tC6ZLJhqYc5LQjnSlqrV/ S7T4ALECYtyTmx4ktsDxmGLniWcYyuo7EzcvyefqFjR5tgNHfDiIznTjNGcgKrmxKlJP ZVp1a4zdDcDBHkIfSsDSU/efA3uBvN0HkeiqkXsMw8gD6LBk6VmEPwqDZOFZcXYi5xns 0otQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eVxNdksJTPOevalf7BH9L1TRDCo8ZI9OB7mA3/aAEj8=; b=sob3mEVfudJMgnNSEvxo5M6WKpKtUtAwjZY8ZIDzruM6dnzlcNW65N3UxUvNYXGANv ijngFOIE6CHvTfzn7e84U0cv9D8sItzdJhTa+PxqlzUq7uXJRdB/vhDgqzY/Z99W9dgA OuHAaPs6CF7I3MbYzL7kBrZUVVRpqNewEHEB+ndd8tXSN84CJvBDWk2XirkKvPgppa7R du6l2oBlFU9u1/WNj/m2YwFLW8cD/i7a6aP8SOJotXw5TeaFrFdqYEBCdHhpTEMvNw/4 /yG3kJ+EnU5X/uKD7+QdrEuv2pENsTs7/BMjxhRaqWijkQd1MVKnoarrMnSKhc5G+bcr fiWQ== X-Gm-Message-State: AJIora/sGY2LZUmGy/f6guguXy4RqwcSDWH/hilY/t1Tgj1jTdg9k2eQ 4rKUbVtXKO3NeYlXnODWZwDb/5ggfpjlP5H+TaI= X-Received: by 2002:a17:907:60cc:b0:722:e564:eb11 with SMTP id hv12-20020a17090760cc00b00722e564eb11mr34082648ejc.736.1657036784885; Tue, 05 Jul 2022 08:59:44 -0700 (PDT) MIME-Version: 1.0 References: <20220705132032.702972-1-yangyingliang@huawei.com> <20220705132032.702972-2-yangyingliang@huawei.com> In-Reply-To: <20220705132032.702972-2-yangyingliang@huawei.com> From: Max Filippov Date: Tue, 5 Jul 2022 08:59:43 -0700 Message-ID: Subject: Re: [PATCH -next 2/2] xtensa: iss: change the return type of iss_net_configure() to void To: Yang Yingliang Cc: LKML , "open list:TENSILICA XTENSA PORT (xtensa)" , Chris Zankel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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. -- Thanks. -- Max