Message ID | 20210423014741.11858-2-ansuelsmth@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Multiple improvement to qca8k stability | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
On 4/22/2021 6:47 PM, Ansuel Smith wrote: > Better handle function qca8k_set_page. The original code requires a > deleay of 5us and set the current page only if the bus write has not > failed. > > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> > --- > drivers/net/dsa/qca8k.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c > index cdaf9f85a2cb..a6d35b825c0e 100644 > --- a/drivers/net/dsa/qca8k.c > +++ b/drivers/net/dsa/qca8k.c > @@ -133,9 +133,12 @@ qca8k_set_page(struct mii_bus *bus, u16 page) > if (page == qca8k_current_page) > return; > > - if (bus->write(bus, 0x18, 0, page) < 0) > + if (bus->write(bus, 0x18, 0, page)) { > dev_err_ratelimited(&bus->dev, > "failed to set qca8k page\n"); > + return; > + } An improvement would be to propagate the return value to the two callers which themselves do allow an error to be propagated no? If you cannot set the page you are pretty much toast.
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index cdaf9f85a2cb..a6d35b825c0e 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -133,9 +133,12 @@ qca8k_set_page(struct mii_bus *bus, u16 page) if (page == qca8k_current_page) return; - if (bus->write(bus, 0x18, 0, page) < 0) + if (bus->write(bus, 0x18, 0, page)) { dev_err_ratelimited(&bus->dev, "failed to set qca8k page\n"); + return; + } + qca8k_current_page = page; }
Better handle function qca8k_set_page. The original code requires a deleay of 5us and set the current page only if the bus write has not failed. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> --- drivers/net/dsa/qca8k.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)