drm/bridge: anx7625: check the return on anx7625_aux_trans
Subsystems (3)
PATCH 1/1 drm/bridge: anx7625: check the return on anx7625_aux_trans
From: Tom Rix <[email protected]>
Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is
a garbage value
if (!(bcap & 0xOA01)) {
~~~~ ^bcap is only set by a successful call toanx7625_aux_trans(). So check.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -1
@@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ -anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); +if (ret <0 ) +return ret; +if (!(bcap &0x01 )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ;
Signature · 1 line
2.26.3
Quoted 6 lines · On Thu, Mar 3, 2022 at 12:19 PM <[email protected]> wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is
a garbage value
Quoted 7 lines
if (!(bcap & 0xOA01)) { ~~~~ ^bcap is only set by a successful call to
anx7625_aux_trans(). So check.Fixes cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
Is this the correct Fixes tag?
I think it should be
through aux channel")
instead.
Quoted 24 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/analogix/anx7625.c +4
-2@@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ -anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); +if (ret <0 ) +return ret; +if (!(bcap &0x01 )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ; --2.26.3
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 9 lines · Nick Desaulniers
Quoted 8 lines · On Thu, Mar 3, 2022 at 12:19 PM <[email protected]> wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is
a garbage valueif (!(bcap & 0xOA01)) { ~~~~ ^
Quoted 5 lines
Quoted 4 lines
bcap is only set by a successful call to
anx7625_aux_trans(). So check.Fixes cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")Is this the correct Fixes tag?
yes
Quoted 4 lines
I think it should be
Fixes adca62ec370c ("drm/bridge: anx7625: Support reading edidthrough aux channel")
This one changes the name of the function
- anx7625_aux_dpcd_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap); + anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
A return check from the earlier commit, when this block of code came into existence, is when it was first needed.
Tom
Quoted 28 lines
instead.
Quoted 24 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/analogix/anx7625.c +4
-2@@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ -anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); +if (ret <0 ) +return ret; +if (!(bcap &0x01 )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ; --2.26.3
Quoted 28 lines · Tom Rix
Quoted 9 lines · Nick Desaulniers
Quoted 8 lines · On Thu, Mar 3, 2022 at 12:19 PM <[email protected]> wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this issue anx7625.c:876:13: warning: The left operand of '&' is
a garbage valueif (!(bcap & 0xOA01)) { ~~~~ ^Quoted 5 lines
Quoted 4 lines
bcap is only set by a successful call to
anx7625_aux_trans(). So check.Fixes cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")Is this the correct Fixes tag?
yes
Quoted 4 lines
I think it should be
Fixes adca62ec370c ("drm/bridge: anx7625: Support reading edidthrough aux channel")
This one changes the name of the function
(quoted diff) +1
-1- anx7625_aux_dpcd_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap); + anx7625_aux_trans(ctx, DP_AUX_NATIVE_READ, 0x68028, 1, &bcap);
Quoted 34 lines
A return check from the earlier commit, when this block of code came into existence, is when it was first needed.
Tom
Quoted 28 lines
instead.
Quoted 24 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/analogix/anx7625.c +4
-2@@ -872,7 +872,10 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ -anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); +if (ret <0 ) +return ret; +if (!(bcap &0x01 )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ; --2.26.3
Applied to drm-misc-next.