dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: gpu: Fix warning using plain integer as NULL
@ 2023-11-03 15:50 Abhinav Singh
  2023-11-06 11:23 ` Jani Nikula
  2023-11-06 18:55 ` Alex Deucher
  0 siblings, 2 replies; 9+ messages in thread
From: Abhinav Singh @ 2023-11-03 15:50 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: Abhinav Singh, linux-kernel-mentees, dri-devel, amd-gfx, linux-kernel

sparse static analysis tools generate a warning with this message
"Using plain integer as NULL pointer". In this case this warning is
being shown because we are trying to intialize a pointer to NULL using
integer value 0.

Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
---
 drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
index 63a1ffbb3ced..3b645558f133 100644
--- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
+++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
@@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
     {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
     {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
     {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
-    { 0, 0, 0 }
+    { NULL, 0, 0 }
 };
 static const u32 SECT_CLEAR_def_1[] =
 {
@@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
 static const struct cs_extent_def SECT_CLEAR_defs[] =
 {
     {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
-    { 0, 0, 0 }
+    { NULL, 0, 0 }
 };
 static const u32 SECT_CTRLCONST_def_1[] =
 {
@@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
 static const struct cs_extent_def SECT_CTRLCONST_defs[] =
 {
     {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
-    { 0, 0, 0 }
+    { NULL, 0, 0 }
 };
 static const struct cs_section_def evergreen_cs_data[] = {
     { SECT_CONTEXT_defs, SECT_CONTEXT },
     { SECT_CLEAR_defs, SECT_CLEAR },
     { SECT_CTRLCONST_defs, SECT_CTRLCONST },
-    { 0, SECT_NONE }
+    { NULL, SECT_NONE }
 };
--
2.39.2


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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-03 15:50 [PATCH] drivers: gpu: Fix warning using plain integer as NULL Abhinav Singh
@ 2023-11-06 11:23 ` Jani Nikula
  2023-11-06 15:21   ` Abhinav Singh
  2023-11-06 18:55 ` Alex Deucher
  1 sibling, 1 reply; 9+ messages in thread
From: Jani Nikula @ 2023-11-06 11:23 UTC (permalink / raw)
  To: Abhinav Singh, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: Abhinav Singh, linux-kernel-mentees, amd-gfx, dri-devel, linux-kernel

On Fri, 03 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
> sparse static analysis tools generate a warning with this message
> "Using plain integer as NULL pointer". In this case this warning is
> being shown because we are trying to intialize a pointer to NULL using
> integer value 0.
>
> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
> ---
>  drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> index 63a1ffbb3ced..3b645558f133 100644
> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>      {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>      {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>      {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }

Random drive-by comment:

I'd just use {} as the sentinel.

BR,
Jani.

>  };
>  static const u32 SECT_CLEAR_def_1[] =
>  {
> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>  static const struct cs_extent_def SECT_CLEAR_defs[] =
>  {
>      {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }
>  };
>  static const u32 SECT_CTRLCONST_def_1[] =
>  {
> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>  static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>  {
>      {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }
>  };
>  static const struct cs_section_def evergreen_cs_data[] = {
>      { SECT_CONTEXT_defs, SECT_CONTEXT },
>      { SECT_CLEAR_defs, SECT_CLEAR },
>      { SECT_CTRLCONST_defs, SECT_CTRLCONST },
> -    { 0, SECT_NONE }
> +    { NULL, SECT_NONE }
>  };
> --
> 2.39.2
>

-- 
Jani Nikula, Intel

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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 11:23 ` Jani Nikula
@ 2023-11-06 15:21   ` Abhinav Singh
  2023-11-06 16:40     ` Jani Nikula
  0 siblings, 1 reply; 9+ messages in thread
From: Abhinav Singh @ 2023-11-06 15:21 UTC (permalink / raw)
  To: Jani Nikula, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: linux-kernel-mentees, amd-gfx, dri-devel, linux-kernel

On 11/6/23 16:53, Jani Nikula wrote:
> On Fri, 03 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
>> sparse static analysis tools generate a warning with this message
>> "Using plain integer as NULL pointer". In this case this warning is
>> being shown because we are trying to intialize a pointer to NULL using
>> integer value 0.
>>
>> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
>> ---
>>   drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> index 63a1ffbb3ced..3b645558f133 100644
>> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>>       {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>>       {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>>       {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
> 
> Random drive-by comment:
> 
> I'd just use {} as the sentinel.
> 
> BR,
> Jani.
> 
>>   };
>>   static const u32 SECT_CLEAR_def_1[] =
>>   {
>> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>>   static const struct cs_extent_def SECT_CLEAR_defs[] =
>>   {
>>       {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
>>   };
>>   static const u32 SECT_CTRLCONST_def_1[] =
>>   {
>> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>>   static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>>   {
>>       {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
>>   };
>>   static const struct cs_section_def evergreen_cs_data[] = {
>>       { SECT_CONTEXT_defs, SECT_CONTEXT },
>>       { SECT_CLEAR_defs, SECT_CLEAR },
>>       { SECT_CTRLCONST_defs, SECT_CTRLCONST },
>> -    { 0, SECT_NONE }
>> +    { NULL, SECT_NONE }
>>   };
>> --
>> 2.39.2
>>
> 
Hi, Thanks for dropping by and the suggestion. I thought of using NULL 
instead of {} is because, first the warning itself says that 0 is used 
to intialize pointers with NULL, and second due this link 
https://www.spinics.net/lists/linux-sparse/msg10066.html where linus is 
talking about not using 0 NULL intialization of pointer variable and he 
thinks this is a legitimate issue and not some false positive


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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 15:21   ` Abhinav Singh
@ 2023-11-06 16:40     ` Jani Nikula
  2023-11-06 18:19       ` Abhinav Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Jani Nikula @ 2023-11-06 16:40 UTC (permalink / raw)
  To: Abhinav Singh, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: linux-kernel-mentees, amd-gfx, dri-devel, linux-kernel

On Mon, 06 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
> On 11/6/23 16:53, Jani Nikula wrote:
>> On Fri, 03 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
>>> sparse static analysis tools generate a warning with this message
>>> "Using plain integer as NULL pointer". In this case this warning is
>>> being shown because we are trying to intialize a pointer to NULL using
>>> integer value 0.
>>>
>>> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
>>> ---
>>>   drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>> index 63a1ffbb3ced..3b645558f133 100644
>>> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>>>       {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>>>       {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>>>       {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
>>> -    { 0, 0, 0 }
>>> +    { NULL, 0, 0 }
>> 
>> Random drive-by comment:
>> 
>> I'd just use {} as the sentinel.
>> 
>> BR,
>> Jani.
>> 
>>>   };
>>>   static const u32 SECT_CLEAR_def_1[] =
>>>   {
>>> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>>>   static const struct cs_extent_def SECT_CLEAR_defs[] =
>>>   {
>>>       {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
>>> -    { 0, 0, 0 }
>>> +    { NULL, 0, 0 }
>>>   };
>>>   static const u32 SECT_CTRLCONST_def_1[] =
>>>   {
>>> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>>>   static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>>>   {
>>>       {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
>>> -    { 0, 0, 0 }
>>> +    { NULL, 0, 0 }
>>>   };
>>>   static const struct cs_section_def evergreen_cs_data[] = {
>>>       { SECT_CONTEXT_defs, SECT_CONTEXT },
>>>       { SECT_CLEAR_defs, SECT_CLEAR },
>>>       { SECT_CTRLCONST_defs, SECT_CTRLCONST },
>>> -    { 0, SECT_NONE }
>>> +    { NULL, SECT_NONE }
>>>   };
>>> --
>>> 2.39.2
>>>
>> 
> Hi, Thanks for dropping by and the suggestion. I thought of using NULL 
> instead of {} is because, first the warning itself says that 0 is used 
> to intialize pointers with NULL, and second due this link 
> https://www.spinics.net/lists/linux-sparse/msg10066.html where linus is 
> talking about not using 0 NULL intialization of pointer variable and he 
> thinks this is a legitimate issue and not some false positive

But... {} is neither of those things. It's empty initialization instead
of 0. It's valid in GCC and C23, and used all over the place in the
kernel.

BR,
Jani.



-- 
Jani Nikula, Intel

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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 16:40     ` Jani Nikula
@ 2023-11-06 18:19       ` Abhinav Singh
  0 siblings, 0 replies; 9+ messages in thread
From: Abhinav Singh @ 2023-11-06 18:19 UTC (permalink / raw)
  To: Jani Nikula, alexander.deucher, christian.koenig, Xinhui.Pan,
	airlied, daniel
  Cc: linux-kernel-mentees, amd-gfx, dri-devel, linux-kernel

On 11/6/23 22:10, Jani Nikula wrote:
> On Mon, 06 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
>> On 11/6/23 16:53, Jani Nikula wrote:
>>> On Fri, 03 Nov 2023, Abhinav Singh <singhabhinav9051571833@gmail.com> wrote:
>>>> sparse static analysis tools generate a warning with this message
>>>> "Using plain integer as NULL pointer". In this case this warning is
>>>> being shown because we are trying to intialize a pointer to NULL using
>>>> integer value 0.
>>>>
>>>> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
>>>> ---
>>>>    drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> index 63a1ffbb3ced..3b645558f133 100644
>>>> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>>>>        {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>>>>        {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>>>>        {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>
>>> Random drive-by comment:
>>>
>>> I'd just use {} as the sentinel.
>>>
>>> BR,
>>> Jani.
>>>
>>>>    };
>>>>    static const u32 SECT_CLEAR_def_1[] =
>>>>    {
>>>> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>>>>    static const struct cs_extent_def SECT_CLEAR_defs[] =
>>>>    {
>>>>        {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>>    };
>>>>    static const u32 SECT_CTRLCONST_def_1[] =
>>>>    {
>>>> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>>>>    static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>>>>    {
>>>>        {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>>    };
>>>>    static const struct cs_section_def evergreen_cs_data[] = {
>>>>        { SECT_CONTEXT_defs, SECT_CONTEXT },
>>>>        { SECT_CLEAR_defs, SECT_CLEAR },
>>>>        { SECT_CTRLCONST_defs, SECT_CTRLCONST },
>>>> -    { 0, SECT_NONE }
>>>> +    { NULL, SECT_NONE }
>>>>    };
>>>> --
>>>> 2.39.2
>>>>
>>>
>> Hi, Thanks for dropping by and the suggestion. I thought of using NULL
>> instead of {} is because, first the warning itself says that 0 is used
>> to intialize pointers with NULL, and second due this link
>> https://www.spinics.net/lists/linux-sparse/msg10066.html where linus is
>> talking about not using 0 NULL intialization of pointer variable and he
>> thinks this is a legitimate issue and not some false positive
> 
> But... {} is neither of those things. It's empty initialization instead
> of 0. It's valid in GCC and C23, and used all over the place in the
> kernel.
> 
> BR,
> Jani.
> 
> 
> 
If I understand correctly you want to me change from this "{ NULL, 
SECT_NONE }" to "{}" right? If yes, then according to what I read from 
some online, it is better to intialize variables especially pointer 
because in some cases a non initialized pointer doesnt always point to 
NULL. Not sure if this applies in kernel space as well. But yeah my 
knowledge is pretty limited in C in user space and in kernel space it is 
even more limited :)


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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-03 15:50 [PATCH] drivers: gpu: Fix warning using plain integer as NULL Abhinav Singh
  2023-11-06 11:23 ` Jani Nikula
@ 2023-11-06 18:55 ` Alex Deucher
  2023-11-06 21:19   ` Abhinav Singh
  1 sibling, 1 reply; 9+ messages in thread
From: Alex Deucher @ 2023-11-06 18:55 UTC (permalink / raw)
  To: Abhinav Singh
  Cc: Xinhui.Pan, linux-kernel, dri-devel, amd-gfx, alexander.deucher,
	linux-kernel-mentees, christian.koenig

Applied.  This matches what we already do in the other clear state headers.

Alex

On Fri, Nov 3, 2023 at 12:00 PM Abhinav Singh
<singhabhinav9051571833@gmail.com> wrote:
>
> sparse static analysis tools generate a warning with this message
> "Using plain integer as NULL pointer". In this case this warning is
> being shown because we are trying to intialize a pointer to NULL using
> integer value 0.
>
> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
> ---
>  drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> index 63a1ffbb3ced..3b645558f133 100644
> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>      {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>      {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>      {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }
>  };
>  static const u32 SECT_CLEAR_def_1[] =
>  {
> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>  static const struct cs_extent_def SECT_CLEAR_defs[] =
>  {
>      {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }
>  };
>  static const u32 SECT_CTRLCONST_def_1[] =
>  {
> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>  static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>  {
>      {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
> -    { 0, 0, 0 }
> +    { NULL, 0, 0 }
>  };
>  static const struct cs_section_def evergreen_cs_data[] = {
>      { SECT_CONTEXT_defs, SECT_CONTEXT },
>      { SECT_CLEAR_defs, SECT_CLEAR },
>      { SECT_CTRLCONST_defs, SECT_CTRLCONST },
> -    { 0, SECT_NONE }
> +    { NULL, SECT_NONE }
>  };
> --
> 2.39.2
>

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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 18:55 ` Alex Deucher
@ 2023-11-06 21:19   ` Abhinav Singh
  2023-11-06 21:37     ` Alex Deucher
  0 siblings, 1 reply; 9+ messages in thread
From: Abhinav Singh @ 2023-11-06 21:19 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Xinhui.Pan, linux-kernel, dri-devel, amd-gfx, alexander.deucher,
	linux-kernel-mentees, christian.koenig

On 11/7/23 00:25, Alex Deucher wrote:
> Applied.  This matches what we already do in the other clear state headers.
> 
> Alex
> 
> On Fri, Nov 3, 2023 at 12:00 PM Abhinav Singh
> <singhabhinav9051571833@gmail.com> wrote:
>>
>> sparse static analysis tools generate a warning with this message
>> "Using plain integer as NULL pointer". In this case this warning is
>> being shown because we are trying to intialize a pointer to NULL using
>> integer value 0.
>>
>> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
>> ---
>>   drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> index 63a1ffbb3ced..3b645558f133 100644
>> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>>       {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>>       {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>>       {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
>>   };
>>   static const u32 SECT_CLEAR_def_1[] =
>>   {
>> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>>   static const struct cs_extent_def SECT_CLEAR_defs[] =
>>   {
>>       {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
>>   };
>>   static const u32 SECT_CTRLCONST_def_1[] =
>>   {
>> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>>   static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>>   {
>>       {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
>> -    { 0, 0, 0 }
>> +    { NULL, 0, 0 }
>>   };
>>   static const struct cs_section_def evergreen_cs_data[] = {
>>       { SECT_CONTEXT_defs, SECT_CONTEXT },
>>       { SECT_CLEAR_defs, SECT_CLEAR },
>>       { SECT_CTRLCONST_defs, SECT_CTRLCONST },
>> -    { 0, SECT_NONE }
>> +    { NULL, SECT_NONE }
>>   };
>> --
>> 2.39.2
>>
Hi Alex, thanks for looking into this. By applied you mean this patch is 
accepted and it has been merged?

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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 21:19   ` Abhinav Singh
@ 2023-11-06 21:37     ` Alex Deucher
  2023-11-07  6:03       ` Abhinav Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Deucher @ 2023-11-06 21:37 UTC (permalink / raw)
  To: Abhinav Singh
  Cc: Xinhui.Pan, linux-kernel, dri-devel, amd-gfx, alexander.deucher,
	linux-kernel-mentees, christian.koenig

On Mon, Nov 6, 2023 at 4:20 PM Abhinav Singh
<singhabhinav9051571833@gmail.com> wrote:
>
> On 11/7/23 00:25, Alex Deucher wrote:
> > Applied.  This matches what we already do in the other clear state headers.
> >
> > Alex
> >
> > On Fri, Nov 3, 2023 at 12:00 PM Abhinav Singh
> > <singhabhinav9051571833@gmail.com> wrote:
> >>
> >> sparse static analysis tools generate a warning with this message
> >> "Using plain integer as NULL pointer". In this case this warning is
> >> being shown because we are trying to intialize a pointer to NULL using
> >> integer value 0.
> >>
> >> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
> >> ---
> >>   drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
> >>   1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> >> index 63a1ffbb3ced..3b645558f133 100644
> >> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
> >> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
> >> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
> >>       {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
> >>       {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
> >>       {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
> >> -    { 0, 0, 0 }
> >> +    { NULL, 0, 0 }
> >>   };
> >>   static const u32 SECT_CLEAR_def_1[] =
> >>   {
> >> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
> >>   static const struct cs_extent_def SECT_CLEAR_defs[] =
> >>   {
> >>       {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
> >> -    { 0, 0, 0 }
> >> +    { NULL, 0, 0 }
> >>   };
> >>   static const u32 SECT_CTRLCONST_def_1[] =
> >>   {
> >> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
> >>   static const struct cs_extent_def SECT_CTRLCONST_defs[] =
> >>   {
> >>       {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
> >> -    { 0, 0, 0 }
> >> +    { NULL, 0, 0 }
> >>   };
> >>   static const struct cs_section_def evergreen_cs_data[] = {
> >>       { SECT_CONTEXT_defs, SECT_CONTEXT },
> >>       { SECT_CLEAR_defs, SECT_CLEAR },
> >>       { SECT_CTRLCONST_defs, SECT_CTRLCONST },
> >> -    { 0, SECT_NONE }
> >> +    { NULL, SECT_NONE }
> >>   };
> >> --
> >> 2.39.2
> >>
> Hi Alex, thanks for looking into this. By applied you mean this patch is
> accepted and it has been merged?

Yes.  Once it makes it through our CI system, it will show up in my
drm-next tree.

Alex

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

* Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL
  2023-11-06 21:37     ` Alex Deucher
@ 2023-11-07  6:03       ` Abhinav Singh
  0 siblings, 0 replies; 9+ messages in thread
From: Abhinav Singh @ 2023-11-07  6:03 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Xinhui.Pan, linux-kernel, dri-devel, amd-gfx, alexander.deucher,
	linux-kernel-mentees, christian.koenig

On 11/7/23 03:07, Alex Deucher wrote:
> On Mon, Nov 6, 2023 at 4:20 PM Abhinav Singh
> <singhabhinav9051571833@gmail.com> wrote:
>>
>> On 11/7/23 00:25, Alex Deucher wrote:
>>> Applied.  This matches what we already do in the other clear state headers.
>>>
>>> Alex
>>>
>>> On Fri, Nov 3, 2023 at 12:00 PM Abhinav Singh
>>> <singhabhinav9051571833@gmail.com> wrote:
>>>>
>>>> sparse static analysis tools generate a warning with this message
>>>> "Using plain integer as NULL pointer". In this case this warning is
>>>> being shown because we are trying to intialize a pointer to NULL using
>>>> integer value 0.
>>>>
>>>> Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
>>>> ---
>>>>    drivers/gpu/drm/radeon/clearstate_evergreen.h | 8 ++++----
>>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/radeon/clearstate_evergreen.h b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> index 63a1ffbb3ced..3b645558f133 100644
>>>> --- a/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> +++ b/drivers/gpu/drm/radeon/clearstate_evergreen.h
>>>> @@ -1049,7 +1049,7 @@ static const struct cs_extent_def SECT_CONTEXT_defs[] =
>>>>        {SECT_CONTEXT_def_5, 0x0000a29e, 5 },
>>>>        {SECT_CONTEXT_def_6, 0x0000a2a5, 56 },
>>>>        {SECT_CONTEXT_def_7, 0x0000a2de, 290 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>>    };
>>>>    static const u32 SECT_CLEAR_def_1[] =
>>>>    {
>>>> @@ -1060,7 +1060,7 @@ static const u32 SECT_CLEAR_def_1[] =
>>>>    static const struct cs_extent_def SECT_CLEAR_defs[] =
>>>>    {
>>>>        {SECT_CLEAR_def_1, 0x0000ffc0, 3 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>>    };
>>>>    static const u32 SECT_CTRLCONST_def_1[] =
>>>>    {
>>>> @@ -1070,11 +1070,11 @@ static const u32 SECT_CTRLCONST_def_1[] =
>>>>    static const struct cs_extent_def SECT_CTRLCONST_defs[] =
>>>>    {
>>>>        {SECT_CTRLCONST_def_1, 0x0000f3fc, 2 },
>>>> -    { 0, 0, 0 }
>>>> +    { NULL, 0, 0 }
>>>>    };
>>>>    static const struct cs_section_def evergreen_cs_data[] = {
>>>>        { SECT_CONTEXT_defs, SECT_CONTEXT },
>>>>        { SECT_CLEAR_defs, SECT_CLEAR },
>>>>        { SECT_CTRLCONST_defs, SECT_CTRLCONST },
>>>> -    { 0, SECT_NONE }
>>>> +    { NULL, SECT_NONE }
>>>>    };
>>>> --
>>>> 2.39.2
>>>>
>> Hi Alex, thanks for looking into this. By applied you mean this patch is
>> accepted and it has been merged?
> 
> Yes.  Once it makes it through our CI system, it will show up in my
> drm-next tree.
> 
> Alex
Okay, this is my first patch to get into kernel :)
Thank you once again for your time with this patch and accepting it.

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

end of thread, other threads:[~2023-11-07  6:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03 15:50 [PATCH] drivers: gpu: Fix warning using plain integer as NULL Abhinav Singh
2023-11-06 11:23 ` Jani Nikula
2023-11-06 15:21   ` Abhinav Singh
2023-11-06 16:40     ` Jani Nikula
2023-11-06 18:19       ` Abhinav Singh
2023-11-06 18:55 ` Alex Deucher
2023-11-06 21:19   ` Abhinav Singh
2023-11-06 21:37     ` Alex Deucher
2023-11-07  6:03       ` Abhinav Singh

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).