lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/3] video: xilinxfb: Use devm_kzalloc instead of kzalloc
Date
Simplify driver probe and release function.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
---
Changes in v3:
- Remove the unnecessary OOM message

Changes in v2:
- Rebased on git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git for-next

drivers/video/xilinxfb.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index d12345f..c420328 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -368,8 +368,6 @@ err_fbmem:
devm_iounmap(dev, drvdata->regs);

err_region:
- kfree(drvdata);
-
return rc;
}

@@ -402,8 +400,6 @@ static int xilinxfb_release(struct device *dev)
dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
#endif

- kfree(drvdata);
-
return 0;
}

@@ -423,11 +419,9 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
pdata = xilinx_fb_default_pdata;

/* Allocate the driver data region */
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- dev_err(&pdev->dev, "Couldn't allocate device private record\n");
+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
return -ENOMEM;
- }

/*
* 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);
if (!DCR_MAP_OK(drvdata->dcr_host)) {
dev_err(&op->dev, "invalid DCR address\n");
- kfree(drvdata);
return -ENODEV;
}
}
--
1.8.2.3
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-10-10 08:41    [W:0.172 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site