video: xilinxfb: Use devm_kzalloc instead of kzalloc
Simplify driver probe and release function. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
353846fb8b
commit
5c128df747
1 changed files with 2 additions and 9 deletions
|
@ -368,8 +368,6 @@ static int xilinxfb_assign(struct platform_device *pdev,
|
||||||
devm_iounmap(dev, drvdata->regs);
|
devm_iounmap(dev, drvdata->regs);
|
||||||
|
|
||||||
err_region:
|
err_region:
|
||||||
kfree(drvdata);
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,8 +400,6 @@ static int xilinxfb_release(struct device *dev)
|
||||||
dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
|
dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kfree(drvdata);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,11 +419,9 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
|
||||||
pdata = xilinx_fb_default_pdata;
|
pdata = xilinx_fb_default_pdata;
|
||||||
|
|
||||||
/* Allocate the driver data region */
|
/* Allocate the driver data region */
|
||||||
drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
|
drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
|
||||||
if (!drvdata) {
|
if (!drvdata)
|
||||||
dev_err(&pdev->dev, "Couldn't allocate device private record\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To check whether the core is connected directly to DCR or BUS
|
* To check whether the core is connected directly to DCR or BUS
|
||||||
|
@ -451,7 +445,6 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
|
||||||
drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len);
|
drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len);
|
||||||
if (!DCR_MAP_OK(drvdata->dcr_host)) {
|
if (!DCR_MAP_OK(drvdata->dcr_host)) {
|
||||||
dev_err(&op->dev, "invalid DCR address\n");
|
dev_err(&op->dev, "invalid DCR address\n");
|
||||||
kfree(drvdata);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue