Re: [PATCH] net: dsa: mt7530: Add some return-value checks

2020-09-17 Thread Landen Chao
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

Re: [PATCH] net: dsa: mt7530: Add some return-value checks

2020-09-16 Thread Alex Dewar
On Wed, Sep 16, 2020 at 08:50:17PM +0100, Alex Dewar wrote: > In mt7531_cpu_port_config(), if the variable port is neither 5 nor 5, This should read "neither 5 nor 6", obviously. I'll fix in v2.

Re: [PATCH] net: dsa: mt7530: Add some return-value checks

2020-09-16 Thread Alex Dewar
[snip] > > > > /* Enable Mediatek header mode on the cpu port */ > > mt7530_write(priv, MT7530_PVC_P(port), > > @@ -2275,7 +2279,7 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int > > port) > > { > > struct mt7530_priv *priv = ds->priv; > > phy_interface_t interface; > > -

Re: [PATCH] net: dsa: mt7530: Add some return-value checks

2020-09-16 Thread Gustavo A. R. Silva
On 9/16/20 14:50, Alex Dewar wrote: [..] > > drivers/net/dsa/mt7530.c | 16 > 1 file changed, 12 insertions(+), 4 deletions(-) > [..] > > /* Enable Mediatek header mode on the cpu port */ > mt7530_write(priv, MT7530_PVC_P(port), > @@ -2275,7 +2279,7 @@

[PATCH] net: dsa: mt7530: Add some return-value checks

2020-09-16 Thread Alex Dewar
In mt7531_cpu_port_config(), if the variable port is neither 5 nor 5, then variable interface will be used uninitialised. Change the function to return -EINVAL in this case. As the return value of mt7531_cpu_port_config() is never checked (even though it returns an int) add a check in the correct