From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: luo penghao <cgel.zte@gmail.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Stephen Rothwell <sfr@canb.auug.org.au>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
luo penghao <luo.penghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] drm/i915/display: Remove unused variable and its assignment.
Date: Mon, 18 Oct 2021 11:57:06 +0300 [thread overview]
Message-ID: <YW024pwrV7fLgV/2@intel.com> (raw)
In-Reply-To: <20211018084331.851975-1-luo.penghao@zte.com.cn>
On Mon, Oct 18, 2021 at 08:43:31AM +0000, luo penghao wrote:
> Variable is not used in functions, and its assignment is redundant too.
> So it should be deleted.
>
> The clang_analyzer complains as follows:
>
> drivers/gpu/drm/i915/display/intel_dpll.c:1653:2 warning:
> Value stored to 'bestm1' is never read.
>
> drivers/gpu/drm/i915/display/intel_dpll.c:1651:2 warning:
> Value stored to 'bestn' is never read.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
> ---
> drivers/gpu/drm/i915/display/intel_dpll.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
> index b84ed4a..28b1616 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll.c
> @@ -1644,13 +1644,11 @@ static void chv_prepare_pll(const struct intel_crtc_state *crtc_state)
> enum pipe pipe = crtc->pipe;
> enum dpio_channel port = vlv_pipe_to_channel(pipe);
> u32 loopfilter, tribuf_calcntr;
> - u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
> + u32 bestm2, bestp1, bestp2, bestm2_frac;
> u32 dpio_val;
> int vco;
>
> - bestn = crtc_state->dpll.n;
This one we could use. For some reason we hardcode it to
1 now, which is correct for our use cases but I don't really
see a reason to hardcode it here. We are supposed to calculate
it correctly after all, and chv_crtc_clock_get() also just blindly
reads it out.
> bestm2_frac = crtc_state->dpll.m2 & 0x3fffff;
> - bestm1 = crtc_state->dpll.m1;
This one is a bit trickier since I don't think the spec even
gives us other values. But we could assert that it's correct.
Some something along these lines I think would be best:
+ drm_WARN_ON(&dev_priv->drm, bestm1 != 2);
vlv_dpio_write(dev_priv, pipe, CHV_PLL_DW1(port),
DPIO_CHV_M1_DIV_BY_2 |
- 1 << DPIO_CHV_N_DIV_SHIFT);
+ bestn << DPIO_CHV_N_DIV_SHIFT);
--
Ville Syrjälä
Intel
prev parent reply other threads:[~2021-10-18 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 8:43 [PATCH linux-next] drm/i915/display: Remove unused variable and its assignment luo penghao
2021-10-18 8:57 ` Ville Syrjälä [this message]
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=YW024pwrV7fLgV/2@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=cgel.zte@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luo.penghao@zte.com.cn \
--cc=rodrigo.vivi@intel.com \
--cc=sfr@canb.auug.org.au \
--cc=zealci@zte.com.cn \
/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