drm/msm/dpu: tidy up some error checking
Subsystems (4)
PATCH 1/1 drm/msm/dpu: tidy up some error checking
The "vsync_hz" variable is unsigned int so it can't be less than zero. The dpu_kms_get_clk_rate() function used to return a u64 but I previously changed it to return an unsigned long and zero on error so it matches clk_get_rate().
Change the "vsync_hz" type to unsigned long as well and change the error checking to check for zero instead of negatives. This change does not affect runtime at all. It's just a clean up.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +4 -4
@@ -324,7 +324,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(struct dpu_hw_tear_check tc_cfg = {0 };struct drm_display_mode *mode;bool tc_enable = true; -u32 vsync_hz; +unsigned long vsync_hz;struct dpu_kms *dpu_kms;if (phys_enc->has_intf_te) {
@@ -359,8 +359,8 @@ static void dpu_encoder_phys_cmd_tearcheck_config(* frequency divided by the no. of rows (lines) in the LCDpanel. */ vsync_hz =dpu_kms_get_clk_rate (dpu_kms,"vsync" ); -if (vsync_hz <=0 ) { -DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %u\n" , +if (!vsync_hz) { +DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %lu\n" , vsync_hz);return ; }
@@ -381,7 +381,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( tc_cfg.rd_ptr_irq = mode->vdisplay +1 ;DPU_DEBUG_CMDENC (cmd_enc, -"tc vsync_clk_speed_hz %u vtotal %u vrefresh %u\n" , +"tc vsync_clk_speed_hz %lu vtotal %u vrefresh %u\n" , vsync_hz, mode->vtotal,drm_mode_vrefresh (mode)); DPU_DEBUG_CMDENC(cmd_enc, "tc enable %u start_pos %u rd_ptr_irq %u\n",
Signature · 1 line
2.39.2
Quoted 11 lines · Dan Carpenter
The "
vsync_hz" variable is unsigned int so it can't be less than zero. Thedpu_kms_get_clk_rate()function used to return a u64 but I previously changed it to return an unsigned long and zero on error so it matchesclk_get_rate().Change the "
vsync_hz" type to unsigned long as well and change the error checking to check for zero instead of negatives. This change does not affect runtime at all. It's just a clean up.Signed-off-by Dan Carpenter <[email protected]>---
Quoted 10 lines · Dan Carpenter
The "
vsync_hz" variable is unsigned int so it can't be less than zero. Thedpu_kms_get_clk_rate()function used to return a u64 but I previously changed it to return an unsigned long and zero on error so it matchesclk_get_rate().Change the "
vsync_hz" type to unsigned long as well and change the error checking to check for zero instead of negatives. This change does not affect runtime at all. It's just a clean up.Signed-off-by Dan Carpenter <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1
-1@@ -324,7 +324,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(struct dpu_hw_tear_check tc_cfg = {0 };struct drm_display_mode *mode;bool tc_enable = true; -u32 vsync_hz; +unsigned long vsync_hz;struct dpu_kms *dpu_kms;if (phys_enc->has_intf_te) {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 364
Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2
-2@@ -359,8 +359,8 @@ static void dpu_encoder_phys_cmd_tearcheck_config(* frequency divided by the no. of rows (lines) in the LCDpanel. */ vsync_hz =dpu_kms_get_clk_rate (dpu_kms,"vsync" ); -if (vsync_hz <=0 ) { -DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %u\n" , +if (!vsync_hz) { +DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %lu\n" , vsync_hz);
Nit: no need to print the value here, you know it's zero. Could be clarified to just "no vsync clock".
- Marijn
Quoted 14 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1
-1return ; }@@ -381,7 +381,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( tc_cfg.rd_ptr_irq = mode->vdisplay +1 ;DPU_DEBUG_CMDENC (cmd_enc, -"tc vsync_clk_speed_hz %u vtotal %u vrefresh %u\n" , +"tc vsync_clk_speed_hz %lu vtotal %u vrefresh %u\n" , vsync_hz, mode->vtotal,drm_mode_vrefresh (mode)); DPU_DEBUG_CMDENC(cmd_enc, "tc enable %u start_pos %u rd_ptr_irq %u\n",Signature · 1 line
2.39.2
Quoted 4 lines · Marijn Suijten
Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-0@@ -359,8 +359,8 @@ static void dpu_encoder_phys_cmd_tearcheck_config(* frequency divided by the no. of rows (lines) in the LCDpanel. */ vsync_hz =dpu_kms_get_clk_rate (dpu_kms,"vsync" );
Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 364
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2
-2-if (vsync_hz <=0 ) { -DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %u\n" , +if (!vsync_hz) { +DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %lu\n" , vsync_hz);Nit: no need to print the value here, you know it's zero. Could be clarified to just "no vsync clock".
Yeah. That's obviously not useful. Sorry, I will resend.
regards,
dan carpenter
Quoted 15 lines · Dan Carpenter
Quoted 4 lines · Marijn Suijten
Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0
-0@@ -359,8 +359,8 @@ static void dpu_encoder_phys_cmd_tearcheck_config(* frequency divided by the no. of rows (lines) in the LCDpanel. */ vsync_hz =dpu_kms_get_clk_rate (dpu_kms,"vsync" );Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 364
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2
-2-if (vsync_hz <=0 ) { -DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %u\n" , +if (!vsync_hz) { +DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %lu\n" , vsync_hz);Nit: no need to print the value here, you know it's zero. Could be clarified to just "no vsync clock".
Quoted 1 line
Yeah. That's obviously not useful. Sorry, I will resend.
I'll fix while applying. Seems easier.
Signature · 2 lines
With best wishes Dmitry
Quoted 16 lines · Dmitry Baryshkov
Quoted 15 lines · Dan Carpenter
Quoted 13 lines · Marijn Suijten
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 364
Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2
-2@@ -359,8 +359,8 @@ static void dpu_encoder_phys_cmd_tearcheck_config(* frequency divided by the no. of rows (lines) in the LCDpanel. */ vsync_hz =dpu_kms_get_clk_rate (dpu_kms,"vsync" ); -if (vsync_hz <=0 ) { -DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %u\n" , +if (!vsync_hz) { +DPU_DEBUG_CMDENC (cmd_enc,"invalid - vsync_hz %lu\n" , vsync_hz);Nit: no need to print the value here, you know it's zero. Could be clarified to just "no vsync clock".
Quoted 3 lines
Quoted 1 line
Yeah. That's obviously not useful. Sorry, I will resend.
I'll fix while applying. Seems easier.
Thanks!
regards,
dan carpenter
Dmitry Baryshkov
AppliedQuoted 10 lines · Dan Carpenter
The "
vsync_hz" variable is unsigned int so it can't be less than zero. Thedpu_kms_get_clk_rate()function used to return a u64 but I previously changed it to return an unsigned long and zero on error so it matchesclk_get_rate().Change the "
vsync_hz" type to unsigned long as well and change the error checking to check for zero instead of negatives. This change does not affect runtime at all. It's just a clean up.[...]
Applied, thanks!
[1/1] drm/msm/dpu: tidy up some error checking
https://gitlab.freedesktop.org/lumag/msm/-/commit/e7a2cf8e058e
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>