lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v3] usb: typec: bus: verify partner exists in typec_altmode_attention
On Fri, Aug 11, 2023 at 09:37:32PM +0000, RD Babiera wrote:
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 5a7d8cc04628..97b7b22e9cf1 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1791,6 +1791,7 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
> u32 p[PD_MAX_PAYLOAD];
> u32 response[8] = { };
> int i, rlen = 0;
> + int ret;
>
> for (i = 0; i < cnt; i++)
> p[i] = le32_to_cpu(payload[i]);
> @@ -1877,7 +1878,9 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
> }
> break;
> case ADEV_ATTENTION:
> - typec_altmode_attention(adev, p[1]);
> + ret = typec_altmode_attention(adev, p[1]);
> + if (ret)
> + tcpm_log(port, "typec_altmode_attention NULL port partner altmode");

I don't think you need that ret variable:

if (typec_altmode_attention(adev, p[1]))
tcpm_log(port, "typec_altmode_attention NULL port partner altmode");

> break;
> }
> }

thanks,

--
heikki
\
 
 \ /
  Last update: 2023-08-14 15:37    [W:0.069 / U:1.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site