Hi Alex,

Thanks for your review and fixing.
On Thu, 2020-09-17 at 03:50 +0800, Alex Dewar wrote:
[..]
> 
> If it is not expected that these functions will throw errors (i.e.
> because the parameters passed will always be correct), we could dispense
> with the use of EINVAL errors and just use BUG*() macros instead. Let me
> know if you'd rather I fix things up in that way.
The cpu port setting is passed by dts. Use EINVAL to catch unexpected
setting is fine.
> 
> Best,
> Alex
> 
>  drivers/net/dsa/mt7530.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 61388945d316..157d0a01faae 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -945,10 +945,14 @@ static int
>  mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
>  {
>       struct mt7530_priv *priv = ds->priv;
> +     int ret;
>  
>       /* Setup max capability of CPU port at first */
> -     if (priv->info->cpu_port_config)
> -             priv->info->cpu_port_config(ds, port);
> +     if (priv->info->cpu_port_config) {
> +             ret = priv->info->cpu_port_config(ds, port);
> +             if (ret)
> +                     return ret;
> +     }
How about check return value in caller function, mt7530_setup() and
mt7531_setup(), too?
                if (dsa_is_cpu_port(ds, i)) {
                        ret = mt753x_cpu_port_enable(ds, i);
                        if (ret)
                                return ret;
                } else {
[..]
regards,
landen

Reply via email to