Commit b0a523fa authored by YueHaibing's avatar YueHaibing Committed by Greg Kroah-Hartman

w1: mxc_w1: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190802134819.9088-1-yuehaibing@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e18a80c
...@@ -92,7 +92,6 @@ static int mxc_w1_probe(struct platform_device *pdev) ...@@ -92,7 +92,6 @@ static int mxc_w1_probe(struct platform_device *pdev)
{ {
struct mxc_w1_device *mdev; struct mxc_w1_device *mdev;
unsigned long clkrate; unsigned long clkrate;
struct resource *res;
unsigned int clkdiv; unsigned int clkdiv;
int err; int err;
...@@ -120,8 +119,7 @@ static int mxc_w1_probe(struct platform_device *pdev) ...@@ -120,8 +119,7 @@ static int mxc_w1_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Incorrect time base frequency %lu Hz\n", clkrate); "Incorrect time base frequency %lu Hz\n", clkrate);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mdev->regs = devm_platform_ioremap_resource(pdev, 0);
mdev->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mdev->regs)) { if (IS_ERR(mdev->regs)) {
err = PTR_ERR(mdev->regs); err = PTR_ERR(mdev->regs);
goto out_disable_clk; goto out_disable_clk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment