Message ID | 20200731125109.18666-3-andr2000@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixes and improvements for Xen pvdrm | expand |
On 31.07.20 14:51, Oleksandr Andrushchenko wrote: > From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> > > The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV > display frontend" from Apr 3, 2018, leads to the following static > checker warning: > > drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() > warn: passing zero to 'ERR_CAST' > > drivers/gpu/drm/xen/xen_drm_front_gem.c > 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, > 134 size_t size) > 135 { > 136 struct xen_gem_object *xen_obj; > 137 > 138 xen_obj = gem_create(dev, size); > 139 if (IS_ERR_OR_NULL(xen_obj)) > 140 return ERR_CAST(xen_obj); > > Fix this and the rest of misused places with IS_ERR_OR_NULL in the > driver. > > Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" Again forgot to Cc stable? Juergen
On 8/4/20 9:12 AM, Jürgen Groß wrote: > On 31.07.20 14:51, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> >> >> The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV >> display frontend" from Apr 3, 2018, leads to the following static >> checker warning: >> >> drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() >> warn: passing zero to 'ERR_CAST' >> >> drivers/gpu/drm/xen/xen_drm_front_gem.c >> 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, >> 134 size_t size) >> 135 { >> 136 struct xen_gem_object *xen_obj; >> 137 >> 138 xen_obj = gem_create(dev, size); >> 139 if (IS_ERR_OR_NULL(xen_obj)) >> 140 return ERR_CAST(xen_obj); >> >> Fix this and the rest of misused places with IS_ERR_OR_NULL in the >> driver. >> >> Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" > > Again forgot to Cc stable? I was just not sure if these minor fixes need to go the stable, but I will add Thank you > > > Juergen
On 04.08.20 08:35, Oleksandr Andrushchenko wrote: > > On 8/4/20 9:12 AM, Jürgen Groß wrote: >> On 31.07.20 14:51, Oleksandr Andrushchenko wrote: >>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> >>> >>> The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV >>> display frontend" from Apr 3, 2018, leads to the following static >>> checker warning: >>> >>> drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() >>> warn: passing zero to 'ERR_CAST' >>> >>> drivers/gpu/drm/xen/xen_drm_front_gem.c >>> 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, >>> 134 size_t size) >>> 135 { >>> 136 struct xen_gem_object *xen_obj; >>> 137 >>> 138 xen_obj = gem_create(dev, size); >>> 139 if (IS_ERR_OR_NULL(xen_obj)) >>> 140 return ERR_CAST(xen_obj); >>> >>> Fix this and the rest of misused places with IS_ERR_OR_NULL in the >>> driver. >>> >>> Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" >> >> Again forgot to Cc stable? > > I was just not sure if these minor fixes need to go the stable, but I will add I'm fine both ways. Its just a reflex when I'm seeing a Fixes: tag but no Cc: stable. :-) Juergen
Looks great! Thanks.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
On Tue, Aug 04, 2020 at 06:35:20AM +0000, Oleksandr Andrushchenko wrote: > > On 8/4/20 9:12 AM, Jürgen Groß wrote: > > On 31.07.20 14:51, Oleksandr Andrushchenko wrote: > >> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> > >> > >> The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV > >> display frontend" from Apr 3, 2018, leads to the following static > >> checker warning: > >> > >> drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() > >> warn: passing zero to 'ERR_CAST' > >> > >> drivers/gpu/drm/xen/xen_drm_front_gem.c > >> 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, > >> 134 size_t size) > >> 135 { > >> 136 struct xen_gem_object *xen_obj; > >> 137 > >> 138 xen_obj = gem_create(dev, size); > >> 139 if (IS_ERR_OR_NULL(xen_obj)) > >> 140 return ERR_CAST(xen_obj); > >> > >> Fix this and the rest of misused places with IS_ERR_OR_NULL in the > >> driver. > >> > >> Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" > > > > Again forgot to Cc stable? > > I was just not sure if these minor fixes need to go the stable, but I will add Correct. It's still a bug because it's setting the error code incorrectly on the impossible path. But fortunately impossible things don't affect runtime. regards, dan carpenter
diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c index 3e660fb111b3..88db2726e8ce 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -400,8 +400,8 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, args->size = args->pitch * args->height; obj = xen_drm_front_gem_create(dev, args->size); - if (IS_ERR_OR_NULL(obj)) { - ret = PTR_ERR_OR_ZERO(obj); + if (IS_ERR(obj)) { + ret = PTR_ERR(obj); goto fail; } diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c index f0b85e094111..4ec8a49241e1 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -83,7 +83,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) size = round_up(size, PAGE_SIZE); xen_obj = gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return xen_obj; if (drm_info->front_info->cfg.be_alloc) { @@ -117,7 +117,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) */ xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE); xen_obj->pages = drm_gem_get_pages(&xen_obj->base); - if (IS_ERR_OR_NULL(xen_obj->pages)) { + if (IS_ERR(xen_obj->pages)) { ret = PTR_ERR(xen_obj->pages); xen_obj->pages = NULL; goto fail; @@ -136,7 +136,7 @@ struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, struct xen_gem_object *xen_obj; xen_obj = gem_create(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); return &xen_obj->base; @@ -194,7 +194,7 @@ xen_drm_front_gem_import_sg_table(struct drm_device *dev, size = attach->dmabuf->size; xen_obj = gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); ret = gem_alloc_pages_array(xen_obj, size); diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c index 78096bbcd226..ef11b1e4de39 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c @@ -60,7 +60,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, int ret; fb = drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &fb_funcs); - if (IS_ERR_OR_NULL(fb)) + if (IS_ERR(fb)) return fb; gem_obj = fb->obj[0];