linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] drm/i915/display: Remove the useless variable offset and its assignment
@ 2021-12-08  7:49 cgel.zte
  2021-12-08  8:40 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-12-08  7:49 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
	Stephen Rothwell, intel-gfx, dri-devel, linux-kernel,
	luo penghao, Zeal Robot

From: luo penghao <luo.penghao@zte.com.cn>

The existence of offset is meaningless, so it should be deleted.

The clang_analyzer complains as follows:

Value stored to 'offset' 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/i9xx_plane.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
index b1439ba..a478b7f 100644
--- a/drivers/gpu/drm/i915/display/i9xx_plane.c
+++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
@@ -964,7 +964,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 	struct intel_plane *plane = to_intel_plane(crtc->base.primary);
 	enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
 	enum pipe pipe;
-	u32 val, base, offset;
+	u32 val, base;
 	int fourcc, pixel_format;
 	unsigned int aligned_height;
 	struct drm_framebuffer *fb;
@@ -1006,14 +1006,14 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 	fb->format = drm_format_info(fourcc);
 
 	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
-		offset = intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
+		intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
 		base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000;
 	} else if (DISPLAY_VER(dev_priv) >= 4) {
 		if (plane_config->tiling)
-			offset = intel_de_read(dev_priv,
+			intel_de_read(dev_priv,
 					       DSPTILEOFF(i9xx_plane));
 		else
-			offset = intel_de_read(dev_priv,
+			intel_de_read(dev_priv,
 					       DSPLINOFF(i9xx_plane));
 		base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000;
 	} else {
-- 
2.15.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] drm/i915/display: Remove the useless variable offset and its assignment
  2021-12-08  7:49 [PATCH linux-next] drm/i915/display: Remove the useless variable offset and its assignment cgel.zte
@ 2021-12-08  8:40 ` Jani Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2021-12-08  8:40 UTC (permalink / raw)
  To: cgel.zte
  Cc: Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
	Stephen Rothwell, intel-gfx, dri-devel, linux-kernel,
	luo penghao, Zeal Robot

On Wed, 08 Dec 2021, cgel.zte@gmail.com wrote:
> From: luo penghao <luo.penghao@zte.com.cn>
>
> The existence of offset is meaningless, so it should be deleted.
>
> The clang_analyzer complains as follows:
>
> Value stored to 'offset' is never read
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: luo penghao <luo.penghao@zte.com.cn>

I've said the same things before, and I'll say them again.

Having an unused variable like this could be an indication of a bug
introduced by an earlier change; maybe we should still be using the
variable but no longer do. Please figure out when the variable became
unused and reference the commit so we can tell.

If cgel.zte@gmail.com sends the patches, we'll need their name and
Signed-off-by too.

Thanks for the report, but I'll consider this as a report only.


BR,
Jani.


> ---
>  drivers/gpu/drm/i915/display/i9xx_plane.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
> index b1439ba..a478b7f 100644
> --- a/drivers/gpu/drm/i915/display/i9xx_plane.c
> +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
> @@ -964,7 +964,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>  	struct intel_plane *plane = to_intel_plane(crtc->base.primary);
>  	enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
>  	enum pipe pipe;
> -	u32 val, base, offset;
> +	u32 val, base;
>  	int fourcc, pixel_format;
>  	unsigned int aligned_height;
>  	struct drm_framebuffer *fb;
> @@ -1006,14 +1006,14 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>  	fb->format = drm_format_info(fourcc);
>  
>  	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> -		offset = intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
> +		intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
>  		base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000;
>  	} else if (DISPLAY_VER(dev_priv) >= 4) {
>  		if (plane_config->tiling)
> -			offset = intel_de_read(dev_priv,
> +			intel_de_read(dev_priv,
>  					       DSPTILEOFF(i9xx_plane));
>  		else
> -			offset = intel_de_read(dev_priv,
> +			intel_de_read(dev_priv,
>  					       DSPLINOFF(i9xx_plane));
>  		base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000;
>  	} else {

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-08  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  7:49 [PATCH linux-next] drm/i915/display: Remove the useless variable offset and its assignment cgel.zte
2021-12-08  8:40 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).