Re: [SMATCH] Can also be NULL false positive
"Ethan Tidmore" <[email protected]> Wed, 08 Apr 2026 08:40:19 -0500
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <[email protected]> |
On Wed Apr 8, 2026 at 1:47 AM CDT, Dan Carpenter wrote:
> On Tue, Apr 07, 2026 at 11:16:45AM -0500, Ethan Tidmore wrote:
>> Hi Dan,
>>=20
>> Smatch gives these two warnings:=20
>>=20
>> drivers/gpu/drm/i915/display/intel_crtc.c:333 __intel_crtc_init() warn: =
'primary' can also be NULL
>> drivers/gpu/drm/i915/display/intel_crtc.c:348 __intel_crtc_init() warn: =
'plane' can also be NULL
>>=20
>> if (DISPLAY_VER(display) >=3D 9)
>> primary =3D skl_universal_plane_create(display, pipe, PLANE_1);
>> else
>> primary =3D intel_primary_plane_create(display, pipe);
>> if (IS_ERR(primary)) {
>> ret =3D PTR_ERR(primary);
>> goto fail;
>> }
>> crtc->plane_ids_mask |=3D BIT(primary->id);
>>=20
>> and
>>=20
>> if (DISPLAY_VER(display) >=3D 9)
>> plane =3D skl_universal_plane_create(display, pipe, PLANE_2 + sprite)=
;
>> else
>> plane =3D intel_sprite_plane_create(display, pipe, sprite);
>> if (IS_ERR(plane)) {
>> ret =3D PTR_ERR(plane);
>> goto fail;
>> }
>> crtc->plane_ids_mask |=3D BIT(plane->id);
>>=20
>> But, this is a false positive because skl_universal_plane_create() and
>> intel_sprite_plane_create() never return NULL and always error pointers.
>
> I don't see that warning on my builds.
>
> One thing that I see is that intel_primary_plane_create() can return NULL
> if CONFIG_I915 is disabled. But I can't see how we would build that
> file without CONFIG_I915. I wondered if it might be a CONFIG_COMPILE_TES=
T
> thing, but I don't see that possibility.
>
> Do you have the cross function DB built?
I'm building with 'allmodconfig' and using these smatch scripts:
./smatch/smatch_scripts/build_kernel_data.sh
./smatch/smatch_scripts/test_kernel.sh --endian
Thanks,
ET
>
> regards,
> dan carpenter