LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH][next] drm/amd/display: remove redundant assignment to status
@ 2019-05-30 16:12 Colin King
2019-05-31 20:19 ` Harry Wentland
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-05-30 16:12 UTC (permalink / raw)
To: Anthony Koo, Harry Wentland, Leo Li, Alex Deucher,
Christian König, David Zhou, David Airlie, Daniel Vetter,
amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable status is initialized with a value that is never read
and status is reassigned several statements later. This initialization
is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 65d6caedbd82..cf6166a1be53 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
@@ -2367,7 +2367,7 @@ static bool retrieve_link_cap(struct dc_link *link)
union down_stream_port_count down_strm_port_count;
union edp_configuration_cap edp_config_cap;
union dp_downstream_port_present ds_port = { 0 };
- enum dc_status status = DC_ERROR_UNEXPECTED;
+ enum dc_status status;
uint32_t read_dpcd_retry_cnt = 3;
int i;
struct dp_sink_hw_fw_revision dp_hw_fw_revision;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] drm/amd/display: remove redundant assignment to status
2019-05-30 16:12 [PATCH][next] drm/amd/display: remove redundant assignment to status Colin King
@ 2019-05-31 20:19 ` Harry Wentland
2019-06-06 10:30 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2019-05-31 20:19 UTC (permalink / raw)
To: Colin King, Koo, Anthony, Wentland, Harry, Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
On 2019-05-30 12:12 p.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable status is initialized with a value that is never read
> and status is reassigned several statements later. This initialization
> is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 65d6caedbd82..cf6166a1be53 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
> @@ -2367,7 +2367,7 @@ static bool retrieve_link_cap(struct dc_link *link)
> union down_stream_port_count down_strm_port_count;
> union edp_configuration_cap edp_config_cap;
> union dp_downstream_port_present ds_port = { 0 };
> - enum dc_status status = DC_ERROR_UNEXPECTED;
> + enum dc_status status;
Not sure this improves the situation.
I'd prefer to have a default here in case someone changes the code below
and forgets to set the status.
Harry
> uint32_t read_dpcd_retry_cnt = 3;
> int i;
> struct dp_sink_hw_fw_revision dp_hw_fw_revision;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] drm/amd/display: remove redundant assignment to status
2019-05-31 20:19 ` Harry Wentland
@ 2019-06-06 10:30 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-06-06 10:30 UTC (permalink / raw)
To: Harry Wentland
Cc: Colin King, Koo, Anthony, Wentland, Harry, Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
David Airlie, Daniel Vetter, amd-gfx, dri-devel, kernel-janitors,
linux-kernel
On Fri, May 31, 2019 at 08:19:03PM +0000, Harry Wentland wrote:
> On 2019-05-30 12:12 p.m., Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The variable status is initialized with a value that is never read
> > and status is reassigned several statements later. This initialization
> > is redundant and can be removed.
> >
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> > drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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 65d6caedbd82..cf6166a1be53 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
> > @@ -2367,7 +2367,7 @@ static bool retrieve_link_cap(struct dc_link *link)
> > union down_stream_port_count down_strm_port_count;
> > union edp_configuration_cap edp_config_cap;
> > union dp_downstream_port_present ds_port = { 0 };
> > - enum dc_status status = DC_ERROR_UNEXPECTED;
> > + enum dc_status status;
>
> Not sure this improves the situation.
>
> I'd prefer to have a default here in case someone changes the code below
> and forgets to set the status.
The dead code confuses human readers, because people naturally assume it
is not dead.
GCC has a feature to warn about uninitialized variables and we're
randomly initializing status to a bogus value to disable static
analysis...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-06 10:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 16:12 [PATCH][next] drm/amd/display: remove redundant assignment to status Colin King
2019-05-31 20:19 ` Harry Wentland
2019-06-06 10:30 ` Dan Carpenter
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).