On Wed, Feb 27, 2013 at 3:49 AM, Vikas Sajjan <vikas.saj...@linaro.org> wrote:
> Add support for parsing the display-timing node using video helper
> function.
>
> The DT node parsing and pinctrl selection is done only if 'dev.of_node'
> exists and the NON-DT logic is still maintained under the 'else' part.
>
> Signed-off-by: Leela Krishna Amudala <l.kris...@samsung.com>
> Signed-off-by: Vikas Sajjan <vikas.saj...@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 9537761..7932dc2 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -20,6 +20,7 @@
>  #include <linux/of_device.h>
>  #include <linux/pm_runtime.h>
>
> +#include <video/of_display_timing.h>
>  #include <video/samsung_fimd.h>
>  #include <drm/exynos_drm.h>
>
> @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev)
>
>         DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -       pdata = pdev->dev.platform_data;
> -       if (!pdata) {
> -               dev_err(dev, "no platform data specified\n");
> -               return -EINVAL;
> +       if (pdev->dev.of_node) {
> +               pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +               if (!pdata) {
> +                       DRM_ERROR("memory allocation for pdata failed\n");
> +                       return -ENOMEM;
> +               }
> +
> +               ret = of_get_fb_videomode(dev->of_node, &pdata->panel.timing,
> +                                       OF_USE_NATIVE_MODE);
> +               if (ret) {
> +                       DRM_ERROR("failed: of_get_fb_videomode()\n"
> +                               "with return value: %d\n", ret);
> +                       return ret;

Here I think you leak pdata in the error path.

Stéphane

> +               }
> +       } else {
> +               pdata = pdev->dev.platform_data;
> +               if (!pdata) {
> +                       DRM_ERROR("no platform data specified\n");
> +                       return -EINVAL;
> +               }
>         }
>
>         panel = &pdata->panel;
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to