[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20190319084455.2d4b6032@shemminger-XPS-13-9360>
Date: Tue, 19 Mar 2019 08:44:55 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: "wanghai (M)" <wanghai26@...wei.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
<davem@...emloft.net>, <idosch@...lanox.com>,
<alexander.h.duyck@...el.com>, <tyhicks@...onical.com>,
<f.fainelli@...il.com>, <amritha.nambiar@...el.com>,
<joe@...ches.com>, <dmitry.torokhov@...il.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net-sysfs: Fix memory leak in netdev_register_kobject
On Tue, 19 Mar 2019 20:17:01 +0800
"wanghai (M)" <wanghai26@...wei.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;
Powered by blists - more mailing lists