<p dir="ltr">Le 24 févr. 2016 18:34, "Thierry Reding" <<a href="mailto:thierry.reding@gmail.com">thierry.reding@gmail.com</a>> a écrit :<br>
><br>
> From: Thierry Reding <<a href="mailto:treding@nvidia.com">treding@nvidia.com</a>><br>
><br>
> The error cleanup paths aren't quite correct and will crash upon<br>
> deferred probe.<br>
><br>
> Cc: <a href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a> # v4.3+<br>
> Signed-off-by: Thierry Reding <<a href="mailto:treding@nvidia.com">treding@nvidia.com</a>><br>
> ---<br>
>  drivers/gpu/drm/nouveau/nouveau_platform.c         |  2 +-<br>
>  drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 40 ++++++++++++++++------<br>
>  2 files changed, 30 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c<br>
> index 8a70cec59bcd..2dfe58af12e4 100644<br>
> --- a/drivers/gpu/drm/nouveau/nouveau_platform.c<br>
> +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c<br>
> @@ -24,7 +24,7 @@<br>
>  static int nouveau_platform_probe(struct platform_device *pdev)<br>
>  {<br>
>         const struct nvkm_device_tegra_func *func;<br>
> -       struct nvkm_device *device;<br>
> +       struct nvkm_device *device = NULL;<br>
>         struct drm_device *drm;<br>
>         int ret;<br>
><br>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c<br>
> index 7f8a42721eb2..e7e581d6a8ff 100644<br>
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c<br>
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c<br>
> @@ -252,32 +252,40 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,<br>
><br>
>         if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL)))<br>
>                 return -ENOMEM;<br>
> -       *pdevice = &tdev->device;<br>
> +<br>
>         tdev->func = func;<br>
>         tdev->pdev = pdev;<br>
>         tdev->irq = -1;<br>
><br>
>         tdev->vdd = devm_regulator_get(&pdev->dev, "vdd");<br>
> -       if (IS_ERR(tdev->vdd))<br>
> -               return PTR_ERR(tdev->vdd);<br>
> +       if (IS_ERR(tdev->vdd)) {<br>
> +               ret = PTR_ERR(tdev->vdd);<br>
> +               goto free;<br>
> +       }<br>
><br>
>         tdev->rst = devm_reset_control_get(&pdev->dev, "gpu");<br>
> -       if (IS_ERR(tdev->rst))<br>
> -               return PTR_ERR(tdev->rst);<br>
> +       if (IS_ERR(tdev->rst)) {<br>
> +               ret = PTR_ERR(tdev->rst);<br>
> +               goto free;<br>
> +       }<br>
><br>
>         tdev->clk = devm_clk_get(&pdev->dev, "gpu");<br>
> -       if (IS_ERR(tdev->clk))<br>
> -               return PTR_ERR(tdev->clk);<br>
> +       if (IS_ERR(tdev->clk)) {<br>
> +               ret = PTR_ERR(tdev->clk);<br>
> +               goto free;<br>
> +       }<br>
><br>
>         tdev->clk_pwr = devm_clk_get(&pdev->dev, "pwr");<br>
> -       if (IS_ERR(tdev->clk_pwr))<br>
> -               return PTR_ERR(tdev->clk_pwr);<br>
> +       if (IS_ERR(tdev->clk_pwr)) {<br>
> +               ret = PTR_ERR(tdev->clk_pwr);<br>
> +               goto free;<br>
> +       }<br>
><br>
>         nvkm_device_tegra_probe_iommu(tdev);<br>
><br>
>         ret = nvkm_device_tegra_power_up(tdev);<br>
>         if (ret)<br>
> -               return ret;<br>
> +               goto remove;<br>
><br>
>         tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value;<br>
>         ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev,<br>
> @@ -285,9 +293,19 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,<br>
>                                cfg, dbg, detect, mmio, subdev_mask,<br>
>                                &tdev->device);<br>
>         if (ret)<br>
> -               return ret;<br>
> +               goto powerdown;<br>
> +<br>
> +       *pdevice = &tdev->device;<br>
><br>
>         return 0;<br>
> +<br>
> +powerdown:<br>
> +       nvkm_device_tegra_power_down(tdev);<br>
> +remove:<br>
> +       nvkm_device_tegra_remove_iommu(tdev);<br>
> +free:<br>
> +       kfree(tdev);<br>
> +       return ret;<br>
>  }<br>
>  #else<br>
>  int<br>
> --<br>
> 2.7.1<br>
></p>
<p dir="ltr">Tested-by: Nicolas Chauvet <<a href="mailto:kwizart@gmail.com">kwizart@gmail.com</a>><br>
Test-HW jetson-tk1</p>
<p dir="ltr">Tested-by on top of Fedora 4.5-r5 kernel package</p>
<p dir="ltr">Thx<br>
</p>