linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amd/display: Fix gcc unused variable warning
@ 2021-06-17  2:31 Pu Lehui
  2021-06-17 18:42 ` Harry Wentland
  0 siblings, 1 reply; 3+ messages in thread
From: Pu Lehui @ 2021-06-17  2:31 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	Xinhui.Pan, airlied, daniel, Jun.Lei, wenjing.liu, Anson.Jacob,
	qingqing.zhuo, Wesley.Chalmers, Jimmy.Kizito, aric.cyr,
	martin.tsai, jinlong.zhang
  Cc: amd-gfx, dri-devel, linux-kernel, pulehui, zhangjinhao2

GCC reports the following warning with W=1:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3635:17:
warning:
 variable ‘status’ set but not used [-Wunused-but-set-variable]
  3635 |  enum dc_status status = DC_ERROR_UNEXPECTED;
       |                 ^~~~~~

The variable should be used for error check, let's fix it.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index fcb635c85330..cf29265870c8 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -3681,6 +3681,10 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
 				DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV,
 				lttpr_dpcd_data,
 				sizeof(lttpr_dpcd_data));
+		if (status != DC_OK) {
+			dm_error("%s: Read LTTPR caps data failed.\n", __func__);
+			return false;
+		}
 
 		link->dpcd_caps.lttpr_caps.revision.raw =
 				lttpr_dpcd_data[DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV -
-- 
2.17.1


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

* Re: [PATCH -next] drm/amd/display: Fix gcc unused variable warning
  2021-06-17  2:31 [PATCH -next] drm/amd/display: Fix gcc unused variable warning Pu Lehui
@ 2021-06-17 18:42 ` Harry Wentland
  2021-06-18 20:33   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2021-06-17 18:42 UTC (permalink / raw)
  To: Pu Lehui, sunpeng.li, alexander.deucher, christian.koenig,
	Xinhui.Pan, airlied, daniel, Jun.Lei, wenjing.liu, Anson.Jacob,
	qingqing.zhuo, Wesley.Chalmers, Jimmy.Kizito, aric.cyr,
	martin.tsai, jinlong.zhang
  Cc: amd-gfx, dri-devel, linux-kernel, zhangjinhao2

On 2021-06-16 10:31 p.m., Pu Lehui wrote:
> GCC reports the following warning with W=1:
> 
> drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3635:17:
> warning:
>  variable ‘status’ set but not used [-Wunused-but-set-variable]
>   3635 |  enum dc_status status = DC_ERROR_UNEXPECTED;
>        |                 ^~~~~~
> 
> The variable should be used for error check, let's fix it.
> 
> Signed-off-by: Pu Lehui <pulehui@huawei.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> index fcb635c85330..cf29265870c8 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> @@ -3681,6 +3681,10 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
>  				DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV,
>  				lttpr_dpcd_data,
>  				sizeof(lttpr_dpcd_data));
> +		if (status != DC_OK) {
> +			dm_error("%s: Read LTTPR caps data failed.\n", __func__);
> +			return false;
> +		}
>  
>  		link->dpcd_caps.lttpr_caps.revision.raw =
>  				lttpr_dpcd_data[DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV -
> 


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

* Re: [PATCH -next] drm/amd/display: Fix gcc unused variable warning
  2021-06-17 18:42 ` Harry Wentland
@ 2021-06-18 20:33   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-06-18 20:33 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Pu Lehui, Leo (Sunpeng) Li, Deucher, Alexander, Christian Koenig,
	xinhui pan, Dave Airlie, Daniel Vetter, Jun Lei, Wenjing Liu,
	Anson Jacob, Qingqing Zhuo, Wesley Chalmers, Jimmy.Kizito, Cyr,
	Aric, Martin Tsai, jinlong zhang, zhangjinhao2,
	Maling list - DRI developers, amd-gfx list, LKML

Applied.  Thanks!

Alex

On Thu, Jun 17, 2021 at 2:43 PM Harry Wentland <harry.wentland@amd.com> wrote:
>
> On 2021-06-16 10:31 p.m., Pu Lehui wrote:
> > GCC reports the following warning with W=1:
> >
> > drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3635:17:
> > warning:
> >  variable ‘status’ set but not used [-Wunused-but-set-variable]
> >   3635 |  enum dc_status status = DC_ERROR_UNEXPECTED;
> >        |                 ^~~~~~
> >
> > The variable should be used for error check, let's fix it.
> >
> > Signed-off-by: Pu Lehui <pulehui@huawei.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> > index fcb635c85330..cf29265870c8 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> > @@ -3681,6 +3681,10 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
> >                               DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV,
> >                               lttpr_dpcd_data,
> >                               sizeof(lttpr_dpcd_data));
> > +             if (status != DC_OK) {
> > +                     dm_error("%s: Read LTTPR caps data failed.\n", __func__);
> > +                     return false;
> > +             }
> >
> >               link->dpcd_caps.lttpr_caps.revision.raw =
> >                               lttpr_dpcd_data[DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV -
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2021-06-18 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  2:31 [PATCH -next] drm/amd/display: Fix gcc unused variable warning Pu Lehui
2021-06-17 18:42 ` Harry Wentland
2021-06-18 20:33   ` Alex Deucher

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