Commit f063d58b authored by YueHaibing's avatar YueHaibing Committed by Jakub Kicinski

ptp: ptp_dte: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent c17e26dd
...@@ -240,14 +240,12 @@ static int ptp_dte_probe(struct platform_device *pdev) ...@@ -240,14 +240,12 @@ static int ptp_dte_probe(struct platform_device *pdev)
{ {
struct ptp_dte *ptp_dte; struct ptp_dte *ptp_dte;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
ptp_dte = devm_kzalloc(dev, sizeof(struct ptp_dte), GFP_KERNEL); ptp_dte = devm_kzalloc(dev, sizeof(struct ptp_dte), GFP_KERNEL);
if (!ptp_dte) if (!ptp_dte)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ptp_dte->regs = devm_platform_ioremap_resource(pdev, 0);
ptp_dte->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(ptp_dte->regs)) if (IS_ERR(ptp_dte->regs))
return PTR_ERR(ptp_dte->regs); return PTR_ERR(ptp_dte->regs);
......
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