diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-07 14:44:30 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-18 15:15:03 +0200 |
commit | 47eb6763ff63126e34785be0ea5f365180595024 (patch) | |
tree | 011f05a72dfe3ab10e1a2b566f5cf3562cf0f6a1 /drivers/video/omap2 | |
parent | OMAPDSS: explicitely initialize dssdev->channel for new displays (diff) | |
download | linux-47eb6763ff63126e34785be0ea5f365180595024.tar.xz linux-47eb6763ff63126e34785be0ea5f365180595024.zip |
OMAPDSS: handle errors in dss_init_device
Add error handling to dss_init_device(), which has, for some reason,
been missing.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r-- | drivers/video/omap2/dss/core.c | 4 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display.c | 23 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 2 |
3 files changed, 22 insertions, 7 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 315f557f1d1a..9315ece90ff1 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -358,7 +358,9 @@ static int dss_driver_probe(struct device *dev) dev_name(dev), dssdev->driver_name, dssdrv->driver.name); - dss_init_device(core.pdev, dssdev); + r = dss_init_device(core.pdev, dssdev); + if (r) + return r; force = core.default_display_name && strcmp(core.default_display_name, dssdev->name) == 0; diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 5f09d503d619..f7190109bd91 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -320,26 +320,39 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev, } EXPORT_SYMBOL(omapdss_default_get_timings); -void dss_init_device(struct platform_device *pdev, +int dss_init_device(struct platform_device *pdev, struct omap_dss_device *dssdev) { struct device_attribute *attr; - int i; - int r; + int i, r; /* create device sysfs files */ i = 0; while ((attr = display_sysfs_attrs[i++]) != NULL) { r = device_create_file(&dssdev->dev, attr); - if (r) + if (r) { + for (i = i - 2; i >= 0; i--) { + attr = display_sysfs_attrs[i]; + device_remove_file(&dssdev->dev, attr); + } + DSSERR("failed to create sysfs file\n"); + return r; + } } /* create display? sysfs links */ r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj, dev_name(&dssdev->dev)); - if (r) + if (r) { + while ((attr = display_sysfs_attrs[i++]) != NULL) + device_remove_file(&dssdev->dev, attr); + DSSERR("failed to create sysfs display link\n"); + return r; + } + + return 0; } void dss_uninit_device(struct platform_device *pdev, diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index a977826d850c..98e82731c60a 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -228,7 +228,7 @@ int dss_suspend_all_devices(void); int dss_resume_all_devices(void); void dss_disable_all_devices(void); -void dss_init_device(struct platform_device *pdev, +int dss_init_device(struct platform_device *pdev, struct omap_dss_device *dssdev); void dss_uninit_device(struct platform_device *pdev, struct omap_dss_device *dssdev); |