Re: [PATCH v13 07/10] drm/bridge: anx7625: Register Type C mode switches
From: Andy Shevchenko
Date: Mon Mar 06 2023 - 06:55:43 EST
On Fri, Mar 03, 2023 at 10:33:47PM +0800, Pin-yen Lin wrote:
> Register USB Type-C mode switches when the "mode-switch" property and
> relevant ports are available in Device Tree. Configure the crosspoint
> switch based on the entered alternate mode for a specific Type-C
> connector.
>
> Crosspoint switch can also be used for switching the output signal for
> different orientations of a single USB Type-C connector, but the
> orientation switch is not implemented yet. A TODO is added for this.
...
> + ctx->port_data = devm_kcalloc(
> + dev, switch_desc->num_typec_switches,
> + sizeof(struct anx7625_typec_port_data), GFP_KERNEL);
I believe I have commented on this (indentation)...
> +
...and this (blank line).
> + if (!ctx->port_data) {
> + ret = -ENOMEM;
> + goto unregister_mux;
> + }
...
> + ctx->port_data[i].orientation = (dp_lanes[0] / 2 == 0) ?
> + TYPEC_ORIENTATION_REVERSE : TYPEC_ORIENTATION_NORMAL;
I believe that this is an error prone check, you should rather do the opposite,
i.e. ' % 2 == 0'.
--
With Best Regards,
Andy Shevchenko