aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-11-20 03:53:27 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 08:19:46 -0400
commite1b94f1df772331026c9b6dd44a5e154e947b44b (patch)
tree1b0177345f9e9232553af64d244b9cf96134f483 /drivers/video/omap2
parente4dace469fa2244e3bff07707b79ef0e1a5d13db (diff)
OMAPDSS: picodlp: use devm_kzalloc for allocating driver data
Use devm_kzalloc instead of kzalloc to allocate driver data for the picodlp panel driver. This simplifies the driver's probe and remove functions. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
index 974ac29236aa..56d536cabf50 100644
--- a/drivers/video/omap2/displays/panel-picodlp.c
+++ b/drivers/video/omap2/displays/panel-picodlp.c
@@ -423,11 +423,11 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
423 struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev); 423 struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev);
424 struct i2c_adapter *adapter; 424 struct i2c_adapter *adapter;
425 struct i2c_client *picodlp_i2c_client; 425 struct i2c_client *picodlp_i2c_client;
426 int r = 0, picodlp_adapter_id; 426 int picodlp_adapter_id;
427 427
428 dssdev->panel.timings = pico_ls_timings; 428 dssdev->panel.timings = pico_ls_timings;
429 429
430 picod = kzalloc(sizeof(struct picodlp_data), GFP_KERNEL); 430 picod = devm_kzalloc(&dssdev->dev, sizeof(*picod), GFP_KERNEL);
431 if (!picod) 431 if (!picod)
432 return -ENOMEM; 432 return -ENOMEM;
433 433
@@ -438,25 +438,21 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
438 adapter = i2c_get_adapter(picodlp_adapter_id); 438 adapter = i2c_get_adapter(picodlp_adapter_id);
439 if (!adapter) { 439 if (!adapter) {
440 dev_err(&dssdev->dev, "can't get i2c adapter\n"); 440 dev_err(&dssdev->dev, "can't get i2c adapter\n");
441 r = -ENODEV; 441 return -ENODEV;
442 goto err;
443 } 442 }
444 443
445 picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info); 444 picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info);
446 if (!picodlp_i2c_client) { 445 if (!picodlp_i2c_client) {
447 dev_err(&dssdev->dev, "can't add i2c device::" 446 dev_err(&dssdev->dev, "can't add i2c device::"
448 " picodlp_i2c_client is NULL\n"); 447 " picodlp_i2c_client is NULL\n");
449 r = -ENODEV; 448 return -ENODEV;
450 goto err;
451 } 449 }
452 450
453 picod->picodlp_i2c_client = picodlp_i2c_client; 451 picod->picodlp_i2c_client = picodlp_i2c_client;
454 452
455 dev_set_drvdata(&dssdev->dev, picod); 453 dev_set_drvdata(&dssdev->dev, picod);
456 return r; 454
457err: 455 return 0;
458 kfree(picod);
459 return r;
460} 456}
461 457
462static void picodlp_panel_remove(struct omap_dss_device *dssdev) 458static void picodlp_panel_remove(struct omap_dss_device *dssdev)