Skip to contentSkip to conversation

media: davinci: Fix implicit enum conversion warning

PATCH In review Nathan Chancellor 2 participants 3 messages Sep 15, 2018 – Sep 19, 2018 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: davinci: Fix implicit enum conversion warning

Clang warns when one enumerated type is implicitly converted to another.

drivers/media/platform/davinci/vpbe_display.c:524:24: warning: implicit conversion from enumeration type 'enum osd_v_exp_ratio' to different enumeration type 'enum osd_h_exp_ratio' [-Wenum-conversion]

                        layer_info->h_exp = V_EXP_6_OVER_5;
                                          ~ ^~~~~~~~~~~~~~

1 warning generated.

This appears to be a copy and paste error judging from the couple of lines directly above this statement and the way that height is handled in the if block above this one.

---
 drivers/media/platform/davinci/vpbe_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe_display.c +1 -1
index d6bf96ad474c..5c235898af7b 100644
@@ -521,7 +521,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev,
 		else if (v_scale == 4)
 			layer_info->v_zoom = ZOOM_X4;
 		if (v_exp)
-			layer_info->h_exp = V_EXP_6_OVER_5;
+			layer_info->v_exp = V_EXP_6_OVER_5;
 	} else {
 		/* no scaling, only cropping. Set display area to crop area */
 		cfg->ysize = expected_ysize;
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Nathan Chancellor

Clang warns when one enumerated type is implicitly converted to another.

drivers/media/platform/davinci/vpbe_display.c:524:24: warning: implicit conversion from enumeration type 'enum osd_v_exp_ratio' to different enumeration type 'enum osd_h_exp_ratio' [-Wenum-conversion]

Quoted 7 lines
                        layer_info->h_exp = V_EXP_6_OVER_5;
                                          ~ ^~~~~~~~~~~~~~

1 warning generated.

This appears to be a copy and paste error judging from the couple of lines directly above this statement and the way that height is handled in the if block above this one.

The above code for reference looks like:
492 if (h_exp)
493 layer_info->h_exp = H_EXP_9_OVER_8;

so it makes sense to me that:
if (h_exp) layer_info->h_exp = H_EXP_...;
then
if (v_exp) layer_info->v_exp = V_EXP_...;

Thanks for this patch Nathan, looks like an actual bug has been fixed.

We should send this to stable if/when it lands. Maybe the maintainers could apply it with:
Cc: [email protected]

Quoted 23 lines
---
 drivers/media/platform/davinci/vpbe_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe_display.c +1 -2
index d6bf96ad474c..5c235898af7b 100644
@@ -521,7 +521,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev,
                else if (v_scale == 4)
                        layer_info->v_zoom = ZOOM_X4;
                if (v_exp)
-                       layer_info->h_exp = V_EXP_6_OVER_5;
+                       layer_info->v_exp = V_EXP_6_OVER_5;
        } else {
                /* no scaling, only cropping. Set display area to crop area */
                cfg->ysize = expected_ysize;
--

2.18.0

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
Quoted 26 lines · Nick Desaulniers
Quoted 6 lines · Nathan Chancellor

Clang warns when one enumerated type is implicitly converted to another.

drivers/media/platform/davinci/vpbe_display.c:524:24: warning: implicit conversion from enumeration type 'enum osd_v_exp_ratio' to different enumeration type 'enum osd_h_exp_ratio' [-Wenum-conversion]

Quoted 7 lines
                        layer_info->h_exp = V_EXP_6_OVER_5;
                                          ~ ^~~~~~~~~~~~~~

1 warning generated.

This appears to be a copy and paste error judging from the couple of lines directly above this statement and the way that height is handled in the if block above this one.

The above code for reference looks like:
492 if (h_exp)
493 layer_info->h_exp = H_EXP_9_OVER_8;

so it makes sense to me that:
if (h_exp) layer_info->h_exp = H_EXP_...;
then
if (v_exp) layer_info->v_exp = V_EXP_...;

Quoted 7 lines

Thanks for this patch Nathan, looks like an actual bug has been fixed.

We should send this to stable if/when it lands. Maybe the maintainers could apply it with:
Cc: [email protected]

Yes, I think this qualifies as stable material. Should I need to send a v2, I will add it; otherwise, it can be added by the maintainers at their discretion.

Thanks for the review!
Nathan

Quoted 29 lines
Quoted 24 lines
---
 drivers/media/platform/davinci/vpbe_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe_display.c +1 -2
index d6bf96ad474c..5c235898af7b 100644
@@ -521,7 +521,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev,
                else if (v_scale == 4)
                        layer_info->v_zoom = ZOOM_X4;
                if (v_exp)
-                       layer_info->h_exp = V_EXP_6_OVER_5;
+                       layer_info->v_exp = V_EXP_6_OVER_5;
        } else {
                /* no scaling, only cropping. Set display area to crop area */
                cfg->ysize = expected_ysize;
--

2.18.0

Signature · 2 lines
Thanks,
~Nick Desaulniers