[PATCH] drm/kmb: Remove an unnecessary NULL check

Chrisanthus, Anitha anitha.chrisanthus at intel.com
Fri Nov 20 01:19:06 UTC 2020


Looks good to me.

Anitha

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter at oracle.com>
> Sent: Monday, November 16, 2020 11:22 PM
> To: Chrisanthus, Anitha <anitha.chrisanthus at intel.com>
> Cc: Dea, Edmund J <edmund.j.dea at intel.com>; David Airlie <airlied at linux.ie>;
> Daniel Vetter <daniel at ffwll.ch>; dri-devel at lists.freedesktop.org; kernel-
> janitors at vger.kernel.org
> Subject: [PATCH] drm/kmb: Remove an unnecessary NULL check
> 
> The NULL checking isn't done consistently in this function and it leads
> to a static checker warning:
> 
>     drivers/gpu/drm/kmb/kmb_drv.c:561 kmb_pm_suspend()
>     error: we previously assumed 'drm' could be null (see line 559)
> 
> Fortunately "drm" cannot be NULL at this point so the check can just be
> removed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> ---
>  drivers/gpu/drm/kmb/kmb_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> index 8c43b136765c..5ff392644603 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -557,7 +557,7 @@ MODULE_DEVICE_TABLE(of, kmb_of_match);
>  static int __maybe_unused kmb_pm_suspend(struct device *dev)
>  {
>  	struct drm_device *drm = dev_get_drvdata(dev);
> -	struct kmb_drm_private *kmb = drm ? to_kmb(drm) : NULL;
> +	struct kmb_drm_private *kmb = to_kmb(drm);
> 
>  	drm_kms_helper_poll_disable(drm);
> 
> --
> 2.28.0



More information about the dri-devel mailing list