diff mbox

drm/msm: Odd PTR_ERR usage

Message ID 1379366394.3828.10.camel@localhost.localdomain (mailing list archive)
State Accepted
Headers show

Commit Message

Thomas Meyer Sept. 16, 2013, 9:19 p.m. UTC
The variable priv->kms is not initialized yet.

Found by "scripts/coccinelle/tests/odd_ptr_err.cocci".
PTR_ERR should access the value just tested by IS_ERR.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

Comments

Rob Clark Sept. 18, 2013, 12:08 a.m. UTC | #1
On Mon, Sep 16, 2013 at 5:19 PM, Thomas Meyer <thomas@m3y3r.de> wrote:
> The variable priv->kms is not initialized yet.
>
> Found by "scripts/coccinelle/tests/odd_ptr_err.cocci".
> PTR_ERR should access the value just tested by IS_ERR.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>

thanks, I've got it queued up

BR,
-R

> ---
>
> diff -u -p a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -199,7 +199,7 @@ static int msm_load(struct drm_device *d
>                  * imx drm driver on iMX5
>                  */
>                 dev_err(dev->dev, "failed to load kms\n");
> -               ret = PTR_ERR(priv->kms);
> +               ret = PTR_ERR(kms);
>                 goto fail;
>         }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff -u -p a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -199,7 +199,7 @@  static int msm_load(struct drm_device *d
 		 * imx drm driver on iMX5
 		 */
 		dev_err(dev->dev, "failed to load kms\n");
-		ret = PTR_ERR(priv->kms);
+		ret = PTR_ERR(kms);
 		goto fail;
 	}