All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/msm/hdmi: remove unnecessary NULL check
@ 2022-11-18 13:03 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-11-18 13:03 UTC (permalink / raw)
  To: Rob Clark, Dmitry Baryshkov
  Cc: Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
	Stephen Boyd, Johan Hovold, Kuogee Hsieh, linux-arm-msm,
	dri-devel, freedreno, kernel-janitors

This code was recently refactored in commit and now the "hdmi" pointer
can't be NULL.  Checking for NULL leads to a Smatch warning:

    drivers/gpu/drm/msm/hdmi/hdmi.c:141 msm_hdmi_init()
    warn: variable dereferenced before check 'hdmi' (see line 119)

Fixes: 69a88d8633ec ("drm/msm/hdmi: move resource allocation to probe function")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
v2: Add a Fixes tag.  Re-work the commit message.

 drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 7001fabd0977..4d3fdc806bef 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -138,8 +138,7 @@ static int msm_hdmi_init(struct hdmi *hdmi)
 	return 0;
 
 fail:
-	if (hdmi)
-		msm_hdmi_destroy(hdmi);
+	msm_hdmi_destroy(hdmi);
 
 	return ret;
 }
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] drm/msm/hdmi: remove unnecessary NULL check
@ 2022-11-18 13:03 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-11-18 13:03 UTC (permalink / raw)
  To: Rob Clark, Dmitry Baryshkov
  Cc: freedreno, Sean Paul, kernel-janitors, Abhinav Kumar, dri-devel,
	Stephen Boyd, linux-arm-msm, Kuogee Hsieh, Johan Hovold

This code was recently refactored in commit and now the "hdmi" pointer
can't be NULL.  Checking for NULL leads to a Smatch warning:

    drivers/gpu/drm/msm/hdmi/hdmi.c:141 msm_hdmi_init()
    warn: variable dereferenced before check 'hdmi' (see line 119)

Fixes: 69a88d8633ec ("drm/msm/hdmi: move resource allocation to probe function")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
v2: Add a Fixes tag.  Re-work the commit message.

 drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 7001fabd0977..4d3fdc806bef 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -138,8 +138,7 @@ static int msm_hdmi_init(struct hdmi *hdmi)
 	return 0;
 
 fail:
-	if (hdmi)
-		msm_hdmi_destroy(hdmi);
+	msm_hdmi_destroy(hdmi);
 
 	return ret;
 }
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/msm/hdmi: remove unnecessary NULL check
  2022-11-18 13:03 ` Dan Carpenter
@ 2022-11-18 14:45   ` Abhinav Kumar
  -1 siblings, 0 replies; 4+ messages in thread
From: Abhinav Kumar @ 2022-11-18 14:45 UTC (permalink / raw)
  To: Dan Carpenter, Rob Clark, Dmitry Baryshkov
  Cc: Sean Paul, David Airlie, Daniel Vetter, Stephen Boyd,
	Johan Hovold, Kuogee Hsieh, linux-arm-msm, dri-devel, freedreno,
	kernel-janitors



On 11/18/2022 5:03 AM, Dan Carpenter wrote:
> This code was recently refactored in commit and now the "hdmi" pointer
> can't be NULL.  Checking for NULL leads to a Smatch warning:
> 
>      drivers/gpu/drm/msm/hdmi/hdmi.c:141 msm_hdmi_init()
>      warn: variable dereferenced before check 'hdmi' (see line 119)
> 
> Fixes: 69a88d8633ec ("drm/msm/hdmi: move resource allocation to probe function")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> v2: Add a Fixes tag.  Re-work the commit message.
> 
>   drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 7001fabd0977..4d3fdc806bef 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -138,8 +138,7 @@ static int msm_hdmi_init(struct hdmi *hdmi)
>   	return 0;
>   
>   fail:
> -	if (hdmi)
> -		msm_hdmi_destroy(hdmi);
> +	msm_hdmi_destroy(hdmi);
>   
>   	return ret;
>   }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/msm/hdmi: remove unnecessary NULL check
@ 2022-11-18 14:45   ` Abhinav Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Abhinav Kumar @ 2022-11-18 14:45 UTC (permalink / raw)
  To: Dan Carpenter, Rob Clark, Dmitry Baryshkov
  Cc: freedreno, Sean Paul, kernel-janitors, dri-devel, Kuogee Hsieh,
	linux-arm-msm, Stephen Boyd, Johan Hovold



On 11/18/2022 5:03 AM, Dan Carpenter wrote:
> This code was recently refactored in commit and now the "hdmi" pointer
> can't be NULL.  Checking for NULL leads to a Smatch warning:
> 
>      drivers/gpu/drm/msm/hdmi/hdmi.c:141 msm_hdmi_init()
>      warn: variable dereferenced before check 'hdmi' (see line 119)
> 
> Fixes: 69a88d8633ec ("drm/msm/hdmi: move resource allocation to probe function")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> v2: Add a Fixes tag.  Re-work the commit message.
> 
>   drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 7001fabd0977..4d3fdc806bef 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -138,8 +138,7 @@ static int msm_hdmi_init(struct hdmi *hdmi)
>   	return 0;
>   
>   fail:
> -	if (hdmi)
> -		msm_hdmi_destroy(hdmi);
> +	msm_hdmi_destroy(hdmi);
>   
>   	return ret;
>   }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-18 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18 13:03 [PATCH v2] drm/msm/hdmi: remove unnecessary NULL check Dan Carpenter
2022-11-18 13:03 ` Dan Carpenter
2022-11-18 14:45 ` Abhinav Kumar
2022-11-18 14:45   ` Abhinav Kumar

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.