aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/xilinxfb.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-10-10 02:30:21 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-10-11 01:56:54 -0400
commit5c128df7471a6917f84cde3cea786541aaa404a2 (patch)
treefaac7132492d1ce7e80aa1e5a7658b604acd1af1 /drivers/video/xilinxfb.c
parent353846fb8bb7d84986116a5be110eefed451af3c (diff)
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>
Diffstat (limited to 'drivers/video/xilinxfb.c')
-rw-r--r--drivers/video/xilinxfb.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index d12345f7fca4..c420328afb40 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -368,8 +368,6 @@ err_fbmem:
368 devm_iounmap(dev, drvdata->regs); 368 devm_iounmap(dev, drvdata->regs);
369 369
370err_region: 370err_region:
371 kfree(drvdata);
372
373 return rc; 371 return rc;
374} 372}
375 373
@@ -402,8 +400,6 @@ static int xilinxfb_release(struct device *dev)
402 dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); 400 dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
403#endif 401#endif
404 402
405 kfree(drvdata);
406
407 return 0; 403 return 0;
408} 404}
409 405
@@ -423,11 +419,9 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
423 pdata = xilinx_fb_default_pdata; 419 pdata = xilinx_fb_default_pdata;
424 420
425 /* Allocate the driver data region */ 421 /* Allocate the driver data region */
426 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 422 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
427 if (!drvdata) { 423 if (!drvdata)
428 dev_err(&pdev->dev, "Couldn't allocate device private record\n");
429 return -ENOMEM; 424 return -ENOMEM;
430 }
431 425
432 /* 426 /*
433 * To check whether the core is connected directly to DCR or BUS 427 * 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)
451 drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len); 445 drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len);
452 if (!DCR_MAP_OK(drvdata->dcr_host)) { 446 if (!DCR_MAP_OK(drvdata->dcr_host)) {
453 dev_err(&op->dev, "invalid DCR address\n"); 447 dev_err(&op->dev, "invalid DCR address\n");
454 kfree(drvdata);
455 return -ENODEV; 448 return -ENODEV;
456 } 449 }
457 } 450 }