From: Johannes Berg <johannes@sipsolutions.net>
To: Souptick Joarder <jrdr.linux@gmail.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
Julian Calaby <julian.calaby@gmail.com>,
Kalle Valo <kvalo@codeaurora.org>
Cc: Rameshwar Sahu <sahu.rameshwar73@gmail.com>
Subject: Re: [PATCH] wl18xx: Handle kfree() in better way when kzalloc fails
Date: Fri, 07 Oct 2016 09:06:03 +0200 [thread overview]
Message-ID: <1475823963.2015.24.camel@sipsolutions.net> (raw)
In-Reply-To: <20161007064923.GA3404@symbol-HP-ZBook-15> (sfid-20161007_084947_718154_2F19A852)
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
next prev parent reply other threads:[~2016-10-07 7:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 6:49 [PATCH] wl18xx: Handle kfree() in better way when kzalloc fails Souptick Joarder
2016-10-07 7:06 ` Johannes Berg [this message]
2016-10-07 7:29 ` souptick joarder
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=1475823963.2015.24.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=jrdr.linux@gmail.com \
--cc=julian.calaby@gmail.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sahu.rameshwar73@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.