From: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
To: balbi-l0cyMroinI0@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
rogerq-l0cyMroinI0@public.gmane.org
Subject: [PATCH 2/8] usb: phy: nop: use devm_kzalloc()
Date: Tue, 12 Mar 2013 13:24:20 +0200 [thread overview]
Message-ID: <1363087466-32444-3-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1363087466-32444-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
Use resource managed kzalloc.
Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Acked-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
drivers/usb/otg/nop-usb-xceiv.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index a3ce24b..af52870 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -100,15 +100,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
enum usb_phy_type type = USB_PHY_TYPE_USB2;
int err;
- nop = kzalloc(sizeof *nop, GFP_KERNEL);
+ nop = devm_kzalloc(&pdev->dev, sizeof(*nop), GFP_KERNEL);
if (!nop)
return -ENOMEM;
- nop->phy.otg = kzalloc(sizeof *nop->phy.otg, GFP_KERNEL);
- if (!nop->phy.otg) {
- kfree(nop);
+ nop->phy.otg = devm_kzalloc(&pdev->dev, sizeof(*nop->phy.otg),
+ GFP_KERNEL);
+ if (!nop->phy.otg)
return -ENOMEM;
- }
if (pdata)
type = pdata->type;
@@ -127,7 +126,7 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
if (err) {
dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
err);
- goto exit;
+ return err;
}
platform_set_drvdata(pdev, nop);
@@ -135,10 +134,6 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier);
return 0;
-exit:
- kfree(nop->phy.otg);
- kfree(nop);
- return err;
}
static int nop_usb_xceiv_remove(struct platform_device *pdev)
@@ -148,8 +143,6 @@ static int nop_usb_xceiv_remove(struct platform_device *pdev)
usb_remove_phy(&nop->phy);
platform_set_drvdata(pdev, NULL);
- kfree(nop->phy.otg);
- kfree(nop);
return 0;
}
--
1.7.4.1
next prev parent reply other threads:[~2013-03-12 11:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 11:24 [PATCH 0/8] USB: PHY: nop: Device tree support for 3.10 Roger Quadros
[not found] ` <1363087466-32444-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-03-12 11:24 ` [PATCH 1/8] usb: phy: nop: Add some parameters to platform data Roger Quadros
2013-03-12 11:54 ` Marc Kleine-Budde
[not found] ` <513F177D.40500-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 14:12 ` Roger Quadros
2013-03-12 14:17 ` Marc Kleine-Budde
[not found] ` <513F38DF.5040404-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 14:28 ` Roger Quadros
[not found] ` <513F3B7E.8000002-l0cyMroinI0@public.gmane.org>
2013-03-12 14:42 ` Marc Kleine-Budde
[not found] ` <513F3EF0.3030609-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-12 15:20 ` Roger Quadros
[not found] ` <513F47B4.2060004-l0cyMroinI0@public.gmane.org>
2013-03-12 16:06 ` Marc Kleine-Budde
2013-03-13 15:17 ` Peter Ujfalusi
[not found] ` <514098A0.1030809-l0cyMroinI0@public.gmane.org>
2013-03-13 15:46 ` Roger Quadros
2013-03-13 15:52 ` Marc Kleine-Budde
2013-03-12 11:24 ` Roger Quadros [this message]
2013-03-12 11:24 ` [PATCH 3/8] usb: phy: nop: Manage PHY clock Roger Quadros
2013-03-12 11:24 ` [PATCH 4/8] usb: phy: nop: Handle power supply regulator for the PHY Roger Quadros
2013-03-12 11:24 ` [PATCH 5/8] usb: phy: nop: Handle RESET " Roger Quadros
2013-03-12 11:24 ` [PATCH 6/8] usb: phy: nop: use new PHY API to register PHY Roger Quadros
2013-03-12 11:24 ` [PATCH 7/8] usb: phy: nop: Add device tree support and binding information Roger Quadros
2013-03-12 11:24 ` [PATCH 8/8] USB: phy: nop: Defer probe if device needs VCC/RESET Roger Quadros
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=1363087466-32444-3-git-send-email-rogerq@ti.com \
--to=rogerq-l0cymroini0@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).