From: Alessandro Zanni <alessandro.zanni87@gmail.com>
To: jani.nikula@linux.intel.com, rodrigo.vivi@intel.com,
joonas.lahtinen@linux.intel.com, tursulin@ursulin.net,
airlied@gmail.com, simona@ffwll.ch
Cc: Alessandro Zanni <alessandro.zanni87@gmail.com>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, anupnewsmail@gmail.com
Subject: [PATCH] gpu: drm: i915: display: Avoid null values intel_plane_atomic_check_with_state
Date: Fri, 27 Sep 2024 02:01:44 +0200 [thread overview]
Message-ID: <20240927000146.50830-1-alessandro.zanni87@gmail.com> (raw)
This fix solves multiple Smatch errors:
drivers/gpu/drm/i915/display/intel_atomic_plane.c:660
intel_plane_atomic_check_with_state() error:
we previously assumed 'fb' could be null (see line 648)
drivers/gpu/drm/i915/display/intel_atomic_plane.c:664
intel_plane_atomic_check_with_state()
error: we previously assumed 'fb' could be null (see line 659)
drivers/gpu/drm/i915/display/intel_atomic_plane.c:671
intel_plane_atomic_check_with_state()
error: we previously assumed 'fb' could be null (see line 663)
We should check first if fb is not null before to access its properties.
Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index e979786aa5cf..1606f79b39e6 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -656,18 +656,18 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
intel_plane_is_scaled(new_plane_state))
new_crtc_state->scaled_planes |= BIT(plane->id);
- if (new_plane_state->uapi.visible &&
+ if (new_plane_state->uapi.visible && fb &&
intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
new_crtc_state->nv12_planes |= BIT(plane->id);
- if (new_plane_state->uapi.visible &&
+ if (new_plane_state->uapi.visible && fb &&
fb->format->format == DRM_FORMAT_C8)
new_crtc_state->c8_planes |= BIT(plane->id);
if (new_plane_state->uapi.visible || old_plane_state->uapi.visible)
new_crtc_state->update_planes |= BIT(plane->id);
- if (new_plane_state->uapi.visible &&
+ if (new_plane_state->uapi.visible && fb &&
intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) {
new_crtc_state->data_rate_y[plane->id] =
intel_plane_data_rate(new_crtc_state, new_plane_state, 0);
--
2.43.0
next reply other threads:[~2024-09-30 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 0:01 Alessandro Zanni [this message]
2024-09-27 8:20 ` [PATCH] gpu: drm: i915: display: Avoid null values intel_plane_atomic_check_with_state Jani Nikula
2024-09-27 11:57 ` Ville Syrjälä
2024-09-27 13:14 ` Jani Nikula
2024-09-27 13:45 ` Ville Syrjälä
2024-09-27 14:07 ` Ville Syrjälä
2024-09-27 8:26 ` ✓ CI.Patch_applied: success for " Patchwork
2024-09-27 8:26 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-27 8:28 ` ✓ CI.KUnit: success " Patchwork
2024-09-27 8:32 ` ✗ CI.Build: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240927000146.50830-1-alessandro.zanni87@gmail.com \
--to=alessandro.zanni87@gmail.com \
--cc=airlied@gmail.com \
--cc=anupnewsmail@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=tursulin@ursulin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox