[SMATCH] Can also be NULL false positive

"Ethan Tidmore" <[email protected]> Tue, 07 Apr 2026 11:16:45 -0500
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
Hi Dan,

Smatch gives these two warnings:=20

drivers/gpu/drm/i915/display/intel_crtc.c:333 __intel_crtc_init() warn: 'pr=
imary' can also be NULL
drivers/gpu/drm/i915/display/intel_crtc.c:348 __intel_crtc_init() warn: 'pl=
ane' can also be NULL

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

and

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

But, this is a false positive because skl_universal_plane_create() and
intel_sprite_plane_create() never return NULL and always error pointers.

Thanks,

ET