linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/msm: remove unnecessary NULL check
@ 2023-10-13  8:25 Dan Carpenter
  2023-10-13  9:54 ` Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dan Carpenter @ 2023-10-13  8:25 UTC (permalink / raw)
  To: Rob Clark
  Cc: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
	David Airlie, Daniel Vetter, Su Hui, Uwe Kleine-König,
	linux-arm-msm, dri-devel, freedreno, kernel-janitors

This NULL check was required when it was added, but we shuffled the code
around and now it's not.  The inconsistent NULL checking triggers a
Smatch warning:

    drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
    variable dereferenced before check 'mdp5_kms' (see line 782)

Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Added a Fixes tag.  It's not really a bug fix and so adding the
fixes tag is slightly unfair but it should prevent this patch from
accidentally getting backported before the refactoring and causing an
issue.

Btw, fixes tags are often unfair like this.  People look at fixes tags
and think, "the fix introduced a bug" but actually it's really common
that the fix was just not complete.  But from a backporting perspective
it makes sense to tie them together.

Plus everyone introduces bugs.  If you're not introducing bugs, then
you're probably not writing a lot of code.

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

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 11d9fc2c6bf5..ec933d597e20 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -844,8 +844,7 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 
 	return 0;
 fail:
-	if (mdp5_kms)
-		mdp5_destroy(mdp5_kms);
+	mdp5_destroy(mdp5_kms);
 	return ret;
 }
 
-- 
2.39.2

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

* Re: [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-10-13  8:25 [PATCH v2] drm/msm: remove unnecessary NULL check Dan Carpenter
@ 2023-10-13  9:54 ` Uwe Kleine-König
  2023-10-25  9:47 ` Dmitry Baryshkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-10-13  9:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
	Marijn Suijten, David Airlie, Daniel Vetter, Su Hui,
	linux-arm-msm, dri-devel, freedreno, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

On Fri, Oct 13, 2023 at 11:25:15AM +0300, Dan Carpenter wrote:
> This NULL check was required when it was added, but we shuffled the code
> around and now it's not.  The inconsistent NULL checking triggers a
> Smatch warning:
> 
>     drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
>     variable dereferenced before check 'mdp5_kms' (see line 782)
> 
> Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

(already provided for (implicit) v1, but wasn't picked up)

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-10-13  8:25 [PATCH v2] drm/msm: remove unnecessary NULL check Dan Carpenter
  2023-10-13  9:54 ` Uwe Kleine-König
@ 2023-10-25  9:47 ` Dmitry Baryshkov
  2023-11-01 19:23 ` Abhinav Kumar
  2023-11-21 18:49 ` Abhinav Kumar
  3 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2023-10-25  9:47 UTC (permalink / raw)
  To: Dan Carpenter, Rob Clark
  Cc: Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
	Daniel Vetter, Su Hui, Uwe Kleine-König, linux-arm-msm,
	dri-devel, freedreno, kernel-janitors

On 13/10/2023 11:25, Dan Carpenter wrote:
> This NULL check was required when it was added, but we shuffled the code
> around and now it's not.  The inconsistent NULL checking triggers a
> Smatch warning:
> 
>      drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
>      variable dereferenced before check 'mdp5_kms' (see line 782)
> 
> Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: Added a Fixes tag.  It's not really a bug fix and so adding the
> fixes tag is slightly unfair but it should prevent this patch from
> accidentally getting backported before the refactoring and causing an
> issue.
> 
> Btw, fixes tags are often unfair like this.  People look at fixes tags
> and think, "the fix introduced a bug" but actually it's really common
> that the fix was just not complete.  But from a backporting perspective
> it makes sense to tie them together.
> 
> Plus everyone introduces bugs.  If you're not introducing bugs, then
> you're probably not writing a lot of code.
> 
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


-- 
With best wishes
Dmitry


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

* Re: [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-10-13  8:25 [PATCH v2] drm/msm: remove unnecessary NULL check Dan Carpenter
  2023-10-13  9:54 ` Uwe Kleine-König
  2023-10-25  9:47 ` Dmitry Baryshkov
@ 2023-11-01 19:23 ` Abhinav Kumar
  2023-11-16 21:05   ` [Freedreno] " Abhinav Kumar
  2023-11-21 18:49 ` Abhinav Kumar
  3 siblings, 1 reply; 7+ messages in thread
From: Abhinav Kumar @ 2023-11-01 19:23 UTC (permalink / raw)
  To: Dan Carpenter, Rob Clark
  Cc: Dmitry Baryshkov, Sean Paul, Marijn Suijten, David Airlie,
	Daniel Vetter, Su Hui, Uwe Kleine-König, linux-arm-msm,
	dri-devel, freedreno, kernel-janitors



On 10/13/2023 1:25 AM, Dan Carpenter wrote:
> This NULL check was required when it was added, but we shuffled the code
> around and now it's not.  The inconsistent NULL checking triggers a
> Smatch warning:
> 
>      drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
>      variable dereferenced before check 'mdp5_kms' (see line 782)
> 
> Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function"
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: Added a Fixes tag.  It's not really a bug fix and so adding the
> fixes tag is slightly unfair but it should prevent this patch from
> accidentally getting backported before the refactoring and causing an
> issue.
> 
> Btw, fixes tags are often unfair like this.  People look at fixes tags
> and think, "the fix introduced a bug" but actually it's really common
> that the fix was just not complete.  But from a backporting perspective
> it makes sense to tie them together.
> 
> Plus everyone introduces bugs.  If you're not introducing bugs, then
> you're probably not writing a lot of code.
> 
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 

LGTM,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>


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

* Re: [Freedreno] [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-11-01 19:23 ` Abhinav Kumar
@ 2023-11-16 21:05   ` Abhinav Kumar
  2023-11-20  8:24     ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Abhinav Kumar @ 2023-11-16 21:05 UTC (permalink / raw)
  To: Dan Carpenter, Rob Clark
  Cc: freedreno, Su Hui, Sean Paul, linux-arm-msm, kernel-janitors,
	dri-devel, Daniel Vetter, Uwe Kleine-König, Dmitry Baryshkov,
	Marijn Suijten, David Airlie



On 11/1/2023 12:23 PM, Abhinav Kumar wrote:
> 
> 
> On 10/13/2023 1:25 AM, Dan Carpenter wrote:
>> This NULL check was required when it was added, but we shuffled the code
>> around and now it's not.  The inconsistent NULL checking triggers a
>> Smatch warning:
>>
>>      drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
>>      variable dereferenced before check 'mdp5_kms' (see line 782)
>>
>> Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the 
>> _probe function"

A small error here. Its missing the closing brace for the Fixes tag.
Checkpatch cries without it.

I have fixed it while applying.

>> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>> ---
>> v2: Added a Fixes tag.  It's not really a bug fix and so adding the
>> fixes tag is slightly unfair but it should prevent this patch from
>> accidentally getting backported before the refactoring and causing an
>> issue.
>>
>> Btw, fixes tags are often unfair like this.  People look at fixes tags
>> and think, "the fix introduced a bug" but actually it's really common
>> that the fix was just not complete.  But from a backporting perspective
>> it makes sense to tie them together.
>>
>> Plus everyone introduces bugs.  If you're not introducing bugs, then
>> you're probably not writing a lot of code.
>>
>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
> 
> LGTM,
> 
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> 

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

* Re: [Freedreno] [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-11-16 21:05   ` [Freedreno] " Abhinav Kumar
@ 2023-11-20  8:24     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2023-11-20  8:24 UTC (permalink / raw)
  To: Abhinav Kumar
  Cc: Rob Clark, freedreno, Su Hui, Sean Paul, linux-arm-msm,
	kernel-janitors, dri-devel, Daniel Vetter, Uwe Kleine-König,
	Dmitry Baryshkov, Marijn Suijten, David Airlie

On Thu, Nov 16, 2023 at 01:05:52PM -0800, Abhinav Kumar wrote:
> 
> 
> On 11/1/2023 12:23 PM, Abhinav Kumar wrote:
> > 
> > 
> > On 10/13/2023 1:25 AM, Dan Carpenter wrote:
> > > This NULL check was required when it was added, but we shuffled the code
> > > around and now it's not.? The inconsistent NULL checking triggers a
> > > Smatch warning:
> > > 
> > > ???? drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
> > > ???? variable dereferenced before check 'mdp5_kms' (see line 782)
> > > 
> > > Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the
> > > _probe function"
> 
> A small error here. Its missing the closing brace for the Fixes tag.
> Checkpatch cries without it.
> 

Sorry.  I must have accidentally deleted it after I ran checkpatch.

> I have fixed it while applying.

Thanks!

regards,
dan carpenter


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

* Re: [PATCH v2] drm/msm: remove unnecessary NULL check
  2023-10-13  8:25 [PATCH v2] drm/msm: remove unnecessary NULL check Dan Carpenter
                   ` (2 preceding siblings ...)
  2023-11-01 19:23 ` Abhinav Kumar
@ 2023-11-21 18:49 ` Abhinav Kumar
  3 siblings, 0 replies; 7+ messages in thread
From: Abhinav Kumar @ 2023-11-21 18:49 UTC (permalink / raw)
  To: Rob Clark, Dan Carpenter
  Cc: Abhinav Kumar, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
	David Airlie, Daniel Vetter, Su Hui, Uwe Kleine-König,
	linux-arm-msm, dri-devel, freedreno, kernel-janitors


On Fri, 13 Oct 2023 11:25:15 +0300, Dan Carpenter wrote:
> This NULL check was required when it was added, but we shuffled the code
> around and now it's not.  The inconsistent NULL checking triggers a
> Smatch warning:
> 
>     drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn:
>     variable dereferenced before check 'mdp5_kms' (see line 782)
> 
> [...]

Applied, thanks!

[1/1] drm/msm: remove unnecessary NULL check
      https://gitlab.freedesktop.org/drm/msm/-/commit/56466f653cb5

Best regards,
-- 
Abhinav Kumar <quic_abhinavk@quicinc.com>

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

end of thread, other threads:[~2023-11-21 18:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13  8:25 [PATCH v2] drm/msm: remove unnecessary NULL check Dan Carpenter
2023-10-13  9:54 ` Uwe Kleine-König
2023-10-25  9:47 ` Dmitry Baryshkov
2023-11-01 19:23 ` Abhinav Kumar
2023-11-16 21:05   ` [Freedreno] " Abhinav Kumar
2023-11-20  8:24     ` Dan Carpenter
2023-11-21 18:49 ` Abhinav Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).