Commit 9963d36d authored by Jyri Sarha's avatar Jyri Sarha

drm/tilcdc: Fix tilcdc_crtc_create() return value handling

Failed tilcdc_crtc_create() error handling was broken, this patch
should fix it.
Signed-off-by: default avatarJyri Sarha <jsarha@ti.com>
Tested-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent 9345235e
...@@ -957,7 +957,7 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) ...@@ -957,7 +957,7 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev) int tilcdc_crtc_create(struct drm_device *dev)
{ {
struct tilcdc_drm_private *priv = dev->dev_private; struct tilcdc_drm_private *priv = dev->dev_private;
struct tilcdc_crtc *tilcdc_crtc; struct tilcdc_crtc *tilcdc_crtc;
...@@ -967,7 +967,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev) ...@@ -967,7 +967,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL); tilcdc_crtc = devm_kzalloc(dev->dev, sizeof(*tilcdc_crtc), GFP_KERNEL);
if (!tilcdc_crtc) { if (!tilcdc_crtc) {
dev_err(dev->dev, "allocation failed\n"); dev_err(dev->dev, "allocation failed\n");
return NULL; return -ENOMEM;
} }
if (priv->rev == 1) { if (priv->rev == 1) {
...@@ -977,7 +977,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev) ...@@ -977,7 +977,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
&tilcdc_crtc->palette_dma_handle, &tilcdc_crtc->palette_dma_handle,
GFP_KERNEL | __GFP_ZERO); GFP_KERNEL | __GFP_ZERO);
if (!tilcdc_crtc->palette_base) if (!tilcdc_crtc->palette_base)
return ERR_PTR(-ENOMEM); return -ENOMEM;
} }
crtc = &tilcdc_crtc->base; crtc = &tilcdc_crtc->base;
...@@ -1020,13 +1020,15 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev) ...@@ -1020,13 +1020,15 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
if (!crtc->port) { /* This should never happen */ if (!crtc->port) { /* This should never happen */
dev_err(dev->dev, "Port node not found in %s\n", dev_err(dev->dev, "Port node not found in %s\n",
dev->dev->of_node->full_name); dev->dev->of_node->full_name);
ret = -EINVAL;
goto fail; goto fail;
} }
} }
return crtc; priv->crtc = crtc;
return 0;
fail: fail:
tilcdc_crtc_destroy(crtc); tilcdc_crtc_destroy(crtc);
return NULL; return -ENOMEM;
} }
...@@ -153,13 +153,11 @@ static const struct drm_mode_config_funcs mode_config_funcs = { ...@@ -153,13 +153,11 @@ static const struct drm_mode_config_funcs mode_config_funcs = {
.atomic_commit = tilcdc_commit, .atomic_commit = tilcdc_commit,
}; };
static int modeset_init(struct drm_device *dev) static void modeset_init(struct drm_device *dev)
{ {
struct tilcdc_drm_private *priv = dev->dev_private; struct tilcdc_drm_private *priv = dev->dev_private;
struct tilcdc_module *mod; struct tilcdc_module *mod;
priv->crtc = tilcdc_crtc_create(dev);
list_for_each_entry(mod, &module_list, list) { list_for_each_entry(mod, &module_list, list) {
DBG("loading module: %s", mod->name); DBG("loading module: %s", mod->name);
mod->funcs->modeset_init(mod, dev); mod->funcs->modeset_init(mod, dev);
...@@ -170,8 +168,6 @@ static int modeset_init(struct drm_device *dev) ...@@ -170,8 +168,6 @@ static int modeset_init(struct drm_device *dev)
dev->mode_config.max_width = tilcdc_crtc_max_width(priv->crtc); dev->mode_config.max_width = tilcdc_crtc_max_width(priv->crtc);
dev->mode_config.max_height = 2048; dev->mode_config.max_height = 2048;
dev->mode_config.funcs = &mode_config_funcs; dev->mode_config.funcs = &mode_config_funcs;
return 0;
} }
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
...@@ -370,11 +366,12 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) ...@@ -370,11 +366,12 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
} }
} }
ret = modeset_init(ddev); ret = tilcdc_crtc_create(ddev);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to initialize mode setting\n"); dev_err(dev, "failed to create crtc\n");
goto init_failed; goto init_failed;
} }
modeset_init(ddev);
if (priv->is_componentized) { if (priv->is_componentized) {
ret = component_bind_all(dev, ddev); ret = component_bind_all(dev, ddev);
......
...@@ -168,7 +168,7 @@ struct tilcdc_panel_info { ...@@ -168,7 +168,7 @@ struct tilcdc_panel_info {
#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev); int tilcdc_crtc_create(struct drm_device *dev);
irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc); irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc);
void tilcdc_crtc_update_clk(struct drm_crtc *crtc); void tilcdc_crtc_update_clk(struct drm_crtc *crtc);
void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc, void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment