From: Jingoo Han <jg1.han@samsung.com>
To: "'Himangi Saraogi'" <himangi774@gmail.com>,
"'Felipe Balbi'" <balbi@ti.com>
Cc: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
"'Julia Lawall'" <julia.lawall@lip6.fr>,
"'Jingoo Han'" <jg1.han@samsung.com>
Subject: Re: [PATCH] usb: phy: drop kfree of devm_kzalloc's data
Date: Mon, 11 Aug 2014 11:15:04 +0900 [thread overview]
Message-ID: <005301cfb50a$1054b140$30fe13c0$%han@samsung.com> (raw)
In-Reply-To: <20140810195937.GA3923@himangi-Dell>
On Monday, August 11, 2014 5:00 AM, Himangi Saraogi wrote:
>
> Using kfree to free data allocated with devm_kzalloc causes double frees.
>
> The Coccinelle semantic patch that fixes this problem is as follows:
>
> // <smpl>
> @@
> expression x;
> @@
>
> x = devm_kzalloc(...)
> ...
> ?-kfree(x);
> // </smpl>
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
> ---
> drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
> index ea9e705..f4b14bd 100644
> --- a/drivers/usb/phy/phy-gpio-vbus-usb.c
> +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
> @@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev)
>
> gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
> GFP_KERNEL);
> - if (!gpio_vbus->phy.otg) {
> - kfree(gpio_vbus);
> + if (!gpio_vbus->phy.otg)
> return -ENOMEM;
> - }
>
> platform_set_drvdata(pdev, gpio_vbus);
> gpio_vbus->dev = &pdev->dev;
> --
> 1.9.1
prev parent reply other threads:[~2014-08-11 2:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-10 19:59 Himangi Saraogi
2014-08-11 2:15 ` Jingoo Han [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='005301cfb50a$1054b140$30fe13c0$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=himangi774@gmail.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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
all inboxes | Powered by JetHome®