lkml.org 
[lkml]   [2019]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net-sysfs: Fix memory leak in netdev_register_kobject
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;

\
 
 \ /
  Last update: 2019-03-19 16:45    [W:0.215 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site