From: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Nicolas Chauvet <kwizart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] drm/nouveau: platform: Fix deferred probe
Date: Thu, 25 Feb 2016 08:33:49 +1000 [thread overview]
Message-ID: <56CE2FCD.6050203@redhat.com> (raw)
In-Reply-To: <1456335283-22097-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 3321 bytes --]
On 02/25/2016 03:34 AM, Thierry Reding wrote:
> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> The error cleanup paths aren't quite correct and will crash upon
> deferred probe.
>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # v4.3+
> Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/gpu/drm/nouveau/nouveau_platform.c | 2 +-
> drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 40 ++++++++++++++++------
> 2 files changed, 30 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c
> index 8a70cec59bcd..2dfe58af12e4 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_platform.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c
> @@ -24,7 +24,7 @@
> static int nouveau_platform_probe(struct platform_device *pdev)
> {
> const struct nvkm_device_tegra_func *func;
> - struct nvkm_device *device;
> + struct nvkm_device *device = NULL;
> struct drm_device *drm;
> int ret;
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> index 7f8a42721eb2..e7e581d6a8ff 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> @@ -252,32 +252,40 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
>
> if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL)))
> return -ENOMEM;
> - *pdevice = &tdev->device;
> +
> tdev->func = func;
> tdev->pdev = pdev;
> tdev->irq = -1;
>
> tdev->vdd = devm_regulator_get(&pdev->dev, "vdd");
> - if (IS_ERR(tdev->vdd))
> - return PTR_ERR(tdev->vdd);
> + if (IS_ERR(tdev->vdd)) {
> + ret = PTR_ERR(tdev->vdd);
> + goto free;
> + }
>
> tdev->rst = devm_reset_control_get(&pdev->dev, "gpu");
> - if (IS_ERR(tdev->rst))
> - return PTR_ERR(tdev->rst);
> + if (IS_ERR(tdev->rst)) {
> + ret = PTR_ERR(tdev->rst);
> + goto free;
> + }
>
> tdev->clk = devm_clk_get(&pdev->dev, "gpu");
> - if (IS_ERR(tdev->clk))
> - return PTR_ERR(tdev->clk);
> + if (IS_ERR(tdev->clk)) {
> + ret = PTR_ERR(tdev->clk);
> + goto free;
> + }
>
> tdev->clk_pwr = devm_clk_get(&pdev->dev, "pwr");
> - if (IS_ERR(tdev->clk_pwr))
> - return PTR_ERR(tdev->clk_pwr);
> + if (IS_ERR(tdev->clk_pwr)) {
> + ret = PTR_ERR(tdev->clk_pwr);
> + goto free;
> + }
>
> nvkm_device_tegra_probe_iommu(tdev);
>
> ret = nvkm_device_tegra_power_up(tdev);
> if (ret)
> - return ret;
> + goto remove;
>
> tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value;
> ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev,
> @@ -285,9 +293,19 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
> cfg, dbg, detect, mmio, subdev_mask,
> &tdev->device);
> if (ret)
> - return ret;
> + goto powerdown;
> +
> + *pdevice = &tdev->device;
>
> return 0;
> +
> +powerdown:
> + nvkm_device_tegra_power_down(tdev);
> +remove:
> + nvkm_device_tegra_remove_iommu(tdev);
> +free:
> + kfree(tdev);
> + return ret;
> }
> #else
> int
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-02-24 22:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 17:34 [PATCH] drm/nouveau: platform: Fix deferred probe Thierry Reding
[not found] ` <1456335283-22097-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-24 22:33 ` Ben Skeggs [this message]
2016-02-24 23:37 ` Alexandre Courbot
2016-02-25 8:44 ` Nicolas Chauvet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CE2FCD.6050203@redhat.com \
--to=bskeggs-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kwizart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.