diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-10-13 11:13:15 +0300 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2021-10-16 02:58:14 +0300 |
commit | 2203bd0e5c12ffc53ffdd4fbd7b12d6ba27e0424 (patch) | |
tree | acd4fa45d8e8064ed12b1a3f84e211985a2fe9f3 /drivers/gpu/drm/msm | |
parent | 027d052a36e56789a2134772bacb4fd0860f03a3 (diff) | |
download | linux-2203bd0e5c12ffc53ffdd4fbd7b12d6ba27e0424.tar.xz |
drm/msm: uninitialized variable in msm_gem_import()
The msm_gem_new_impl() function cleans up after itself so there is no
need to call drm_gem_object_put(). Conceptually, it does not make sense
to call a kref_put() function until after the reference counting has
been initialized which happens immediately after this call in the
drm_gem_(private_)object_init() functions.
In the msm_gem_import() function the "obj" pointer is uninitialized, so
it will lead to a crash.
Fixes: 05b849111c07 ("drm/msm: prime support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211013081315.GG6010@kili
Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index fd398a4eaf46..bd6ec04f345e 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -1167,7 +1167,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, uint32_t size, uint32 ret = msm_gem_new_impl(dev, size, flags, &obj); if (ret) - goto fail; + return ERR_PTR(ret); msm_obj = to_msm_bo(obj); @@ -1251,7 +1251,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj); if (ret) - goto fail; + return ERR_PTR(ret); drm_gem_private_object_init(dev, obj, size); |