All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [bug report] drm/i915: Extract intel_bw_check_data_rate()
Date: Fri, 25 Feb 2022 12:59:46 +0300	[thread overview]
Message-ID: <20220225095945.GA775@kili> (raw)

Hello Ville Syrjälä,

The patch 6d8ebef53c2c: "drm/i915: Extract
intel_bw_check_data_rate()" from Feb 18, 2022, leads to the following
Smatch static checker warning:

	drivers/gpu/drm/i915/display/intel_bw.c:922 intel_bw_atomic_check()
	error: we previously assumed 'new_bw_state' could be null (see line 910)

drivers/gpu/drm/i915/display/intel_bw.c
    885 int intel_bw_atomic_check(struct intel_atomic_state *state)
    886 {
    887         struct drm_i915_private *dev_priv = to_i915(state->base.dev);
    888         const struct intel_bw_state *old_bw_state;
    889         struct intel_bw_state *new_bw_state;
    890         unsigned int data_rate;
    891         unsigned int num_active_planes;
    892         int i, ret;
    893         u32 allowed_points = 0;
    894         unsigned int max_bw_point = 0, max_bw = 0;
    895         unsigned int num_qgv_points = dev_priv->max_bw[0].num_qgv_points;
    896         unsigned int num_psf_gv_points = dev_priv->max_bw[0].num_psf_gv_points;
    897         bool changed = false;
    898 
    899         /* FIXME earlier gens need some checks too */
    900         if (DISPLAY_VER(dev_priv) < 11)
    901                 return 0;
    902 
    903         ret = intel_bw_check_data_rate(state, &changed);

Before "changed" could only be true when "new_bw_state" was non-NULL

    904         if (ret)
    905                 return ret;
    906 
    907         old_bw_state = intel_atomic_get_old_bw_state(state);
    908         new_bw_state = intel_atomic_get_new_bw_state(state);
    909 
    910         if (new_bw_state &&
    911             intel_can_enable_sagv(dev_priv, old_bw_state) !=
    912             intel_can_enable_sagv(dev_priv, new_bw_state))
    913                 changed = true;
                        ^^^^^^^^^^^^^^^

    914 
    915         /*
    916          * If none of our inputs (data rates, number of active
    917          * planes, SAGV yes/no) changed then nothing to do here.
    918          */
    919         if (!changed)
                    ^^^^^^^^
So after this check then we knew that "new_bw_state" as non-NULL

    920                 return 0;
    921 
--> 922         ret = intel_atomic_lock_global_state(&new_bw_state->base);
                                                      ^^^^^^^^^^^^^^^^^^
But now that relationship is not so clear so it causes a Smatch warning.


    923         if (ret)
    924                 return ret;
    925 
    926         data_rate = intel_bw_data_rate(dev_priv, new_bw_state);
    927         data_rate = DIV_ROUND_UP(data_rate, 1000);
    928 

regards,
dan carpenter

                 reply	other threads:[~2022-02-25 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220225095945.GA775@kili \
    --to=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.