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

Alex Deucher alexdeucher at gmail.com
Mon Nov 6 21:37:14 UTC 2023


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


More information about the amd-gfx mailing list