* [PATCH] drm/amd/display: Remove the redundant initialization of local variable
@ 2021-05-31 9:30 Shaokun Zhang
2021-06-02 2:09 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Shaokun Zhang @ 2021-05-31 9:30 UTC (permalink / raw
To: amd-gfx, dri-devel; +Cc: Shaokun Zhang, Leo Li, Alex Deucher, Harry Wentland
Local variable 'i' and 'j' will be initialized in the for loop, so
remove the redundant initialization.
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 4713f09bcbf1..e4f2a2d3a819 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -304,7 +304,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
struct dc_stream_state *stream,
struct dc_crtc_timing_adjust *adjust)
{
- int i = 0;
+ int i;
bool ret = false;
stream->adjust.v_total_max = adjust->v_total_max;
@@ -332,7 +332,7 @@ bool dc_stream_get_crtc_position(struct dc *dc,
{
/* TODO: Support multiple streams */
const struct dc_stream_state *stream = streams[0];
- int i = 0;
+ int i;
bool ret = false;
struct crtc_position position;
@@ -539,7 +539,7 @@ void dc_stream_set_dyn_expansion(struct dc *dc, struct dc_stream_state *stream,
enum dc_dynamic_expansion option)
{
/* OPP FMT dyn expansion updates*/
- int i = 0;
+ int i;
struct pipe_ctx *pipe_ctx;
for (i = 0; i < MAX_PIPES; i++) {
@@ -597,7 +597,7 @@ void dc_stream_set_dither_option(struct dc_stream_state *stream,
bool dc_stream_set_gamut_remap(struct dc *dc, const struct dc_stream_state *stream)
{
- int i = 0;
+ int i;
bool ret = false;
struct pipe_ctx *pipes;
@@ -614,7 +614,7 @@ bool dc_stream_set_gamut_remap(struct dc *dc, const struct dc_stream_state *stre
bool dc_stream_program_csc_matrix(struct dc *dc, struct dc_stream_state *stream)
{
- int i = 0;
+ int i;
bool ret = false;
struct pipe_ctx *pipes;
@@ -640,8 +640,7 @@ void dc_stream_set_static_screen_params(struct dc *dc,
int num_streams,
const struct dc_static_screen_params *params)
{
- int i = 0;
- int j = 0;
+ int i, j;
struct pipe_ctx *pipes_affected[MAX_PIPES];
int num_pipes_affected = 0;
@@ -896,7 +895,7 @@ static void disable_all_writeback_pipes_for_stream(
static void apply_ctx_interdependent_lock(struct dc *dc, struct dc_state *context,
struct dc_stream_state *stream, bool lock)
{
- int i = 0;
+ int i;
/* Checks if interdependent update function pointer is NULL or not, takes care of DCE110 case */
if (dc->hwss.interdependent_update_lock)
@@ -1156,7 +1155,7 @@ static void enable_timing_multisync(
struct dc *dc,
struct dc_state *ctx)
{
- int i = 0, multisync_count = 0;
+ int i, multisync_count = 0;
int pipe_count = dc->res_pool->pipe_count;
struct pipe_ctx *multisync_pipes[MAX_PIPES] = { NULL };
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/display: Remove the redundant initialization of local variable
2021-05-31 9:30 [PATCH] drm/amd/display: Remove the redundant initialization of local variable Shaokun Zhang
@ 2021-06-02 2:09 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-06-02 2:09 UTC (permalink / raw
To: Shaokun Zhang
Cc: Leo Li, Alex Deucher, Maling list - DRI developers, amd-gfx list
Applied. Thanks!
Alex
On Mon, May 31, 2021 at 5:30 AM Shaokun Zhang
<zhangshaokun@hisilicon.com> wrote:
>
> Local variable 'i' and 'j' will be initialized in the for loop, so
> remove the redundant initialization.
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 4713f09bcbf1..e4f2a2d3a819 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -304,7 +304,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
> struct dc_stream_state *stream,
> struct dc_crtc_timing_adjust *adjust)
> {
> - int i = 0;
> + int i;
> bool ret = false;
>
> stream->adjust.v_total_max = adjust->v_total_max;
> @@ -332,7 +332,7 @@ bool dc_stream_get_crtc_position(struct dc *dc,
> {
> /* TODO: Support multiple streams */
> const struct dc_stream_state *stream = streams[0];
> - int i = 0;
> + int i;
> bool ret = false;
> struct crtc_position position;
>
> @@ -539,7 +539,7 @@ void dc_stream_set_dyn_expansion(struct dc *dc, struct dc_stream_state *stream,
> enum dc_dynamic_expansion option)
> {
> /* OPP FMT dyn expansion updates*/
> - int i = 0;
> + int i;
> struct pipe_ctx *pipe_ctx;
>
> for (i = 0; i < MAX_PIPES; i++) {
> @@ -597,7 +597,7 @@ void dc_stream_set_dither_option(struct dc_stream_state *stream,
>
> bool dc_stream_set_gamut_remap(struct dc *dc, const struct dc_stream_state *stream)
> {
> - int i = 0;
> + int i;
> bool ret = false;
> struct pipe_ctx *pipes;
>
> @@ -614,7 +614,7 @@ bool dc_stream_set_gamut_remap(struct dc *dc, const struct dc_stream_state *stre
>
> bool dc_stream_program_csc_matrix(struct dc *dc, struct dc_stream_state *stream)
> {
> - int i = 0;
> + int i;
> bool ret = false;
> struct pipe_ctx *pipes;
>
> @@ -640,8 +640,7 @@ void dc_stream_set_static_screen_params(struct dc *dc,
> int num_streams,
> const struct dc_static_screen_params *params)
> {
> - int i = 0;
> - int j = 0;
> + int i, j;
> struct pipe_ctx *pipes_affected[MAX_PIPES];
> int num_pipes_affected = 0;
>
> @@ -896,7 +895,7 @@ static void disable_all_writeback_pipes_for_stream(
> static void apply_ctx_interdependent_lock(struct dc *dc, struct dc_state *context,
> struct dc_stream_state *stream, bool lock)
> {
> - int i = 0;
> + int i;
>
> /* Checks if interdependent update function pointer is NULL or not, takes care of DCE110 case */
> if (dc->hwss.interdependent_update_lock)
> @@ -1156,7 +1155,7 @@ static void enable_timing_multisync(
> struct dc *dc,
> struct dc_state *ctx)
> {
> - int i = 0, multisync_count = 0;
> + int i, multisync_count = 0;
> int pipe_count = dc->res_pool->pipe_count;
> struct pipe_ctx *multisync_pipes[MAX_PIPES] = { NULL };
>
> --
> 2.7.4
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-02 2:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-31 9:30 [PATCH] drm/amd/display: Remove the redundant initialization of local variable Shaokun Zhang
2021-06-02 2:09 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).