From: Chanwoo Choi <cw00.choi@samsung.com>
To: anish kumar <anish198519851985@gmail.com>
Cc: gregkh@linuxfoundation.org, myungjoo.ham@samsung.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] extcon: driver model release call not needed
Date: Mon, 22 Oct 2012 09:55:52 +0900 [thread overview]
Message-ID: <50849998.2010201@samsung.com> (raw)
In-Reply-To: <1350794811-12388-1-git-send-email-anish198519851985@gmail.com>
On 10/21/2012 01:46 PM, anish kumar wrote:
> From: anish kumar <anish198519851985@gmail.com>
>
> There was a case where free and list_del can be called twice
> on the same pointer.So fixed it by re-arranging the code and
> removing a function which was not needed.
>
> Signed-off-by: anish kumar <anish198519851985@gmail.com>
> ---
> drivers/extcon/extcon-class.c | 71 ++++++++++++++++++-----------------------
> 1 files changed, 31 insertions(+), 40 deletions(-)
>
Applied, thanks,
But, There were some minor issue, so I fix and applied it.
[...]
> static void extcon_dev_release(struct device *dev)
> {
> - struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev);
> -
> - extcon_cleanup(edev, true);
> + struct extcon_dev *edev = dev_get_drvdata(dev);
> + kfree(edev->dev);
It is not necessary to get extcon_dev instance through dev_get_drvdata()
and only call kfree(dev) by using extcon_dev_release()'s parameter.
kfree(dev);
> }
>
> static const char *muex_name = "mutually_exclusive";
> @@ -810,7 +773,35 @@ EXPORT_SYMBOL_GPL(extcon_dev_register);
> */
> void extcon_dev_unregister(struct extcon_dev *edev)
> {
> - extcon_cleanup(edev, false);
> + mutex_lock(&extcon_dev_list_lock);
> + list_del(&edev->entry);
> + mutex_unlock(&extcon_dev_list_lock);
> +
> + if (get_device(edev->dev) != NULL) {
I prefer minimal indentation, so I will modify as below code.
int index;
mutex_lock(&extcon_dev_list_lock);
list_del(&edev->entry);
mutex_unlock(&extcon_dev_list_lock);
if (IS_ERR_OR_NULL(get_device(edev->dev))) {
dev_err(edev->dev, "Failed to unregister extcon_dev (%s)\n",
dev_name(edev->dev));
return;
}
if (edev->mutually_exclusive && edev->max_supported) {
for (index = 0; edev->mutually_exclusive[index];
index++)
kfree(edev->d_attrs_muex[index].attr.name);
kfree(edev->d_attrs_muex);
kfree(edev->attrs_muex);
}
[...]
Cheers,
Chanwoo Choi
prev parent reply other threads:[~2012-10-22 0:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-21 4:46 anish kumar
2012-10-21 4:48 ` anish kumar
2012-10-22 0:55 ` Chanwoo Choi [this message]
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=50849998.2010201@samsung.com \
--to=cw00.choi@samsung.com \
--cc=anish198519851985@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.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
Powered by JetHome