mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "wanghai (M)" <wanghai26@huawei.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	<davem@davemloft.net>, <idosch@mellanox.com>,
	<alexander.h.duyck@intel.com>, <tyhicks@canonical.com>,
	<f.fainelli@gmail.com>, <amritha.nambiar@intel.com>,
	<joe@perches.com>, <dmitry.torokhov@gmail.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net-sysfs: Fix memory leak in netdev_register_kobject
Date: Tue, 19 Mar 2019 08:44:55 -0700	[thread overview]
Message-ID: <20190319084455.2d4b6032@shemminger-XPS-13-9360> (raw)
In-Reply-To: <18553079-7bbd-fcfe-ef1c-6717e963e0a5@huawei.com>

On Tue, 19 Mar 2019 20:17:01 +0800
"wanghai (M)" <wanghai26@huawei.com> wrote:

> +out:
>          return error;
> +register_error:
> +       device_del(dev);
> +device_add_error:
> +       put_device(dev);
> +       goto out;

Everything looks fine, but I would redo the last part without
the last goto out. Using a goto back to single return reduces
readability.

	if (error)
               goto register_error;
        
	pm_runtime_set_memalloc_noio(dev, true);
	return 0;

register_error:
      device_del(dev);
device_add_error:
       put_device(dev);
       return error;

  parent reply	other threads:[~2019-03-19 15:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  5:06 Wang Hai
2019-03-18 15:57 ` Stephen Hemminger
2019-03-18 16:19   ` Andy Shevchenko
     [not found]     ` <c1c266af-7aaa-00a7-aa7a-e61c65665741@huawei.com>
2019-03-19 10:30       ` Andy Shevchenko
     [not found]         ` <18553079-7bbd-fcfe-ef1c-6717e963e0a5@huawei.com>
2019-03-19 14:00           ` Andy Shevchenko
2019-03-19 15:44           ` Stephen Hemminger [this message]
2019-03-19  3:03   ` wanghai (M)
2019-03-19  3:15     ` Stephen Hemminger
2019-03-19  3:39       ` wanghai (M)
2019-03-19 10:22         ` Andy Shevchenko
2019-03-18 18:02 ` Eric Dumazet
2019-03-19  3:47   ` wanghai (M)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190319084455.2d4b6032@shemminger-XPS-13-9360 \
    --to=stephen@networkplumber.org \
    --cc=alexander.h.duyck@intel.com \
    --cc=amritha.nambiar@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tyhicks@canonical.com \
    --cc=wanghai26@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®