From: Ajay Singh <ajay.kathat@microchip.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <linux-wireless@vger.kernel.org>, <devel@driverdev.osuosl.org>,
<venkateswara.kaja@microchip.com>, <gregkh@linuxfoundation.org>,
<ganesh.krishna@microchip.com>, <adham.abozaeid@microchip.com>,
<aditya.shankar@microchip.com>
Subject: Re: [PATCH 4/9] staging: wilc1000: free memory allocated in add wep key functions
Date: Mon, 26 Mar 2018 16:54:52 +0530 [thread overview]
Message-ID: <20180326165452.478099d0@ajaysk-VirtualBox> (raw)
In-Reply-To: <20180326081748.srvuwoekodihtpfh@mwanda>
Hi Dan,
On Mon, 26 Mar 2018 11:17:48 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Fri, Mar 23, 2018 at 08:38:53PM +0530, Ajay Singh wrote:
> We should "return result;" here otherwise we'll hang when we
> wait_for_completion(). This is the sort of bug why I always encourage
> people to keep the error path and success path separate (unless they
> both have to unlock or free the same resources).
>
Yes, wait_for_completion() will hang for the error path. I have included
the changes in V2 patch series.
>
> This code works, but it would look cleaner with "return result;".
>
> result = wilc_enqueue_cmd(&msg);
> if (result) {
> netdev_err(vif->ndev, "AP - WEP Key\n");
> kfree(msg.body.key_info.attr.wep.key);
> return result;
> }
>
> wait_for_completion(&hif_drv->comp_test_key_block);
> return 0;
>
> I removed a blank line between the wilc_enqueue_cmd() and the error
> handling because they're very connected. All the success path is at
> indent level one so you can just glance at the function and see what
> it's supposed to do in the normal case. The error handling is self
> contained at indent level two.
>
I will send the updated patch by modifying the code as suggested.
Regards,
Ajay
next prev parent reply other threads:[~2018-03-26 11:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 15:08 [PATCH 0/9] staging: wilc1000: fix memory leaks and checkpatch reported issues Ajay Singh
2018-03-23 15:08 ` [PATCH 1/9] staging: wilc1000: remove unused global variables related to p2p Ajay Singh
2018-03-23 15:08 ` [PATCH 2/9] staging: wilc1000: avoid 'NULL' pointer access in wilc_network_info_received() Ajay Singh
2018-03-23 15:08 ` [PATCH 3/9] staging: wilc1000: free allocated memory in edit and add station functions Ajay Singh
2018-03-23 15:08 ` [PATCH 4/9] staging: wilc1000: free memory allocated in add wep key functions Ajay Singh
2018-03-26 8:17 ` Dan Carpenter
2018-03-26 11:24 ` Ajay Singh [this message]
2018-03-23 15:08 ` [PATCH 5/9] staging: wilc1000: free allocated memory after processing wilc_send_config_pkt() Ajay Singh
2018-03-23 15:08 ` [PATCH 6/9] staging: wilc1000: fix to free allocated memory in wilc_add_ptk() Ajay Singh
2018-03-23 15:08 ` [PATCH 7/9] staging: wilc1000: free allocated memory in wilc_add_rx_gtk() Ajay Singh
2018-03-23 15:08 ` [PATCH 8/9] staging: wilc1000: split handle_rcvd_gnrl_async_info() to avoid leading tabs Ajay Singh
2018-03-23 15:08 ` [PATCH 9/9] staging: wilc1000: free memory allocated for general info message from firmware Ajay Singh
2018-03-26 8:32 ` Dan Carpenter
2018-03-26 11:31 ` Ajay Singh
2018-03-26 12:24 ` Dan Carpenter
2018-03-26 8:40 ` [PATCH 0/9] staging: wilc1000: fix memory leaks and checkpatch reported issues Claudiu Beznea
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=20180326165452.478099d0@ajaysk-VirtualBox \
--to=ajay.kathat@microchip.com \
--cc=adham.abozaeid@microchip.com \
--cc=aditya.shankar@microchip.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-wireless@vger.kernel.org \
--cc=venkateswara.kaja@microchip.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;
as well as URLs for NNTP newsgroup(s).