2023-11-03 15:51:54

by Abhinav Singh

[permalink] [raw]
Subject: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

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 <[email protected]>
---
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


2023-11-06 11:23:43

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On Fri, 03 Nov 2023, Abhinav Singh <[email protected]> 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 <[email protected]>
> ---
> 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

2023-11-06 15:21:37

by Abhinav Singh

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On 11/6/23 16:53, Jani Nikula wrote:
> On Fri, 03 Nov 2023, Abhinav Singh <[email protected]> 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 <[email protected]>
>> ---
>> 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

2023-11-06 16:41:22

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On Mon, 06 Nov 2023, Abhinav Singh <[email protected]> wrote:
> On 11/6/23 16:53, Jani Nikula wrote:
>> On Fri, 03 Nov 2023, Abhinav Singh <[email protected]> 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 <[email protected]>
>>> ---
>>> 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

2023-11-06 18:19:49

by Abhinav Singh

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On 11/6/23 22:10, Jani Nikula wrote:
> On Mon, 06 Nov 2023, Abhinav Singh <[email protected]> wrote:
>> On 11/6/23 16:53, Jani Nikula wrote:
>>> On Fri, 03 Nov 2023, Abhinav Singh <[email protected]> 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 <[email protected]>
>>>> ---
>>>> 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 :)

2023-11-06 18:56:06

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

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
<[email protected]> 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 <[email protected]>
> ---
> 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
>

2023-11-06 21:20:45

by Abhinav Singh

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

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
> <[email protected]> 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 <[email protected]>
>> ---
>> 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?

2023-11-06 21:37:45

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On Mon, Nov 6, 2023 at 4:20 PM Abhinav Singh
<[email protected]> 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
> > <[email protected]> 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 <[email protected]>
> >> ---
> >> 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

2023-11-07 06:04:00

by Abhinav Singh

[permalink] [raw]
Subject: Re: [PATCH] drivers: gpu: Fix warning using plain integer as NULL

On 11/7/23 03:07, Alex Deucher wrote:
> On Mon, Nov 6, 2023 at 4:20 PM Abhinav Singh
> <[email protected]> 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
>>> <[email protected]> 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 <[email protected]>
>>>> ---
>>>> 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.