lkml.org 
[lkml]   [2021]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 3/3] usb: typec: tcpm: Get Sink VDO from fwnode
From
Date
On 1/31/21 7:18 AM, Kyle Tso wrote:
> Commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config
> configuration mechanism") removed the tcpc_config which includes the
> Sink VDO and it is not yet added back with fwnode. Add it now.
>
> Signed-off-by: Kyle Tso <kyletso@google.com>
> ---
> Changes since v1:
> - updated the commit message
>
> drivers/usb/typec/tcpm/tcpm.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 403a483645dd..84c8a52f8af1 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5677,6 +5677,18 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
> port->new_source_frs_current = frs_current;
> }
>
> + ret = fwnode_property_read_u32_array(fwnode, "sink-vdos", NULL, 0);

fwnode_property_count_u32(), maybe ?

> + if (ret <= 0 && ret != -EINVAL) {
> + return -EINVAL;

Why return any error except -EINVAL (including return values of 0) as -EINVAL,
and -EINVAL as no error ?

> + } else if (ret > 0) {
> + port->nr_snk_vdo = min(ret, VDO_MAX_OBJECTS);
> + ret = fwnode_property_read_u32_array(fwnode, "sink-vdos",
> + port->snk_vdo,
> + port->nr_snk_vdo);
> + if (ret < 0)
> + return -EINVAL;

static analyzer code used to complain about overriding error codes.
Not sure if that is still true. Either case, why not return the
original error ?

Thanks,
Guenter

> + }
> +
> return 0;
> }
>
>

\
 
 \ /
  Last update: 2021-01-31 17:04    [W:0.125 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site