* [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
@ 2022-03-03 20:19 trix
2022-03-08 22:57 ` Nick Desaulniers
0 siblings, 1 reply; 4+ messages in thread
From: trix @ 2022-03-03 20:19 UTC (permalink / raw)
To: andrzej.hajda, narmstrong, robert.foss, Laurent.pinchart, jonas,
jernej.skrabec, airlied, daniel, nathan, ndesaulniers, xji,
hsinyi, sam, tzungbi, pihsun, maxime
Cc: dri-devel, linux-kernel, llvm, Tom Rix
From: Tom Rix <trix@redhat.com>
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 to
anx7625_aux_trans(). So check.
Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 633618bafd75d..f02ac079ed2ec 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
2022-03-03 20:19 [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans trix
@ 2022-03-08 22:57 ` Nick Desaulniers
2022-03-09 1:45 ` Tom Rix
0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2022-03-08 22:57 UTC (permalink / raw)
To: trix
Cc: andrzej.hajda, narmstrong, robert.foss, laurent.pinchart, jonas,
jernej.skrabec, airlied, daniel, nathan, xji, sam, tzungbi,
pihsun, maxime, dri-devel, linux-kernel, llvm, hsinyi
On Thu, Mar 3, 2022 at 12:19 PM <trix@redhat.com> wrote:
>
> From: Tom Rix <trix@redhat.com>
>
> 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 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
Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid
through aux channel")
instead.
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 633618bafd75d..f02ac079ed2ec 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -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
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
2022-03-08 22:57 ` Nick Desaulniers
@ 2022-03-09 1:45 ` Tom Rix
2022-03-09 13:48 ` Robert Foss
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2022-03-09 1:45 UTC (permalink / raw)
To: Nick Desaulniers
Cc: andrzej.hajda, narmstrong, robert.foss, laurent.pinchart, jonas,
jernej.skrabec, airlied, daniel, nathan, xji, sam, tzungbi,
pihsun, maxime, dri-devel, linux-kernel, llvm, hsinyi
On 3/8/22 2:57 PM, Nick Desaulniers wrote:
> On Thu, Mar 3, 2022 at 12:19 PM <trix@redhat.com> wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> 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 to
>> anx7625_aux_trans(). So check.
>>
>> Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
> Is this the correct Fixes tag?
yes
> I think it should be
>
> Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid
> through 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
>
> instead.
>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>> drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
>> index 633618bafd75d..f02ac079ed2ec 100644
>> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
>> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
>> @@ -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
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans
2022-03-09 1:45 ` Tom Rix
@ 2022-03-09 13:48 ` Robert Foss
0 siblings, 0 replies; 4+ messages in thread
From: Robert Foss @ 2022-03-09 13:48 UTC (permalink / raw)
To: Tom Rix
Cc: Nick Desaulniers, andrzej.hajda, narmstrong, laurent.pinchart,
jonas, jernej.skrabec, airlied, daniel, nathan, xji, sam,
tzungbi, pihsun, maxime, dri-devel, linux-kernel, llvm, hsinyi
On Wed, 9 Mar 2022 at 02:45, Tom Rix <trix@redhat.com> wrote:
>
>
> On 3/8/22 2:57 PM, Nick Desaulniers wrote:
> > On Thu, Mar 3, 2022 at 12:19 PM <trix@redhat.com> wrote:
> >> From: Tom Rix <trix@redhat.com>
> >>
> >> 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 to
> >> anx7625_aux_trans(). So check.
> >>
> >> Fixes: cd1637c7e480 ("drm/bridge: anx7625: add HDCP support")
> > Is this the correct Fixes tag?
> yes
> > I think it should be
> >
> > Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid
> > through 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
>
> >
> > instead.
> >
> >> Signed-off-by: Tom Rix <trix@redhat.com>
> >> ---
> >> drivers/gpu/drm/bridge/analogix/anx7625.c | 5 ++++-
> >> 1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> >> index 633618bafd75d..f02ac079ed2ec 100644
> >> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> >> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> >> @@ -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
> >>
> >
>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Applied to drm-misc-next.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-09 13:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 20:19 [PATCH] drm/bridge: anx7625: check the return on anx7625_aux_trans trix
2022-03-08 22:57 ` Nick Desaulniers
2022-03-09 1:45 ` Tom Rix
2022-03-09 13:48 ` Robert Foss
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).