aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto2012-09-10 19:01:07 -0700
committerGreg Kroah-Hartman2012-09-11 13:57:18 -0700
commit58efc77c86af5cb81d7d7ea0c3c3e675e7d121dc (patch)
tree16c8c67763b52fe8da8128f848a089b456363d81
parent1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7 (diff)
usb: renesas_usbhs: convert to devm_xxx()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/renesas_usbhs/common.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 681da06170c2..072edc1cc55f 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -432,17 +432,16 @@ static int usbhs_probe(struct platform_device *pdev)
}
/* usb private data */
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(&pdev->dev, "Could not allocate priv\n");
return -ENOMEM;
}
- priv->base = ioremap_nocache(res->start, resource_size(res));
+ priv->base = devm_request_and_ioremap(&pdev->dev, res);
if (!priv->base) {
dev_err(&pdev->dev, "ioremap error.\n");
- ret = -ENOMEM;
- goto probe_end_kfree;
+ return -ENOMEM;
}
/*
@@ -485,7 +484,7 @@ static int usbhs_probe(struct platform_device *pdev)
/* call pipe and module init */
ret = usbhs_pipe_probe(priv);
if (ret < 0)
- goto probe_end_iounmap;
+ return ret;
ret = usbhs_fifo_probe(priv);
if (ret < 0)
@@ -546,10 +545,6 @@ probe_end_fifo_exit:
usbhs_fifo_remove(priv);
probe_end_pipe_exit:
usbhs_pipe_remove(priv);
-probe_end_iounmap:
- iounmap(priv->base);
-probe_end_kfree:
- kfree(priv);
dev_info(&pdev->dev, "probe failed\n");
@@ -576,8 +571,6 @@ static int __devexit usbhs_remove(struct platform_device *pdev)
usbhs_mod_remove(priv);
usbhs_fifo_remove(priv);
usbhs_pipe_remove(priv);
- iounmap(priv->base);
- kfree(priv);
return 0;
}