On Fri, 2016-10-07 at 12:19 +0530, Souptick Joarder wrote:
> This patch is added to handle kfree and return error in a better way

What's "better" about this?

kfree(NULL) is perfectly valid, adding another label makes the code
harder to read,

> -     struct wl18xx_cmd_scan_params *cmd;
> +     struct wl18xx_cmd_scan_params *cmd = NULL;

that new initialization is actually *completely* pointless since it's
overwritten immediately here:

>       struct wlcore_scan_channels *cmd_channels = NULL;
>       int ret;
>  
>       cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
>       if (!cmd) {
> -             ret = -ENOMEM;
> -             goto out;
> +             return -ENOMEM;
>       }
> 
...

what gives?

johannes

Reply via email to