[U-Boot] [PATCH] net: eth-uclass: call stop only for active devices
Bin Meng
bmeng.cn at gmail.com
Wed Feb 27 06:05:00 UTC 2019
On Wed, Feb 27, 2019 at 1:47 PM Keerthy <a0393675 at ti.com> wrote:
>
>
>
> On 22/02/19 12:08 AM, Joe Hershberger wrote:
> > On Wed, Feb 20, 2019 at 6:33 AM Keerthy <j-keerthy at ti.com> wrote:
> >>
> >> Currently stop is being called unconditionally without even
> >> checking if start is called. In case of multiple instances eth
> >> being present many devices might just be initialized without
> >> a start call in such cases stop might lead unpredictable behaviors
> >> including aborts and crashes. Hence add a check before calling stop.
> >>
> >> Signed-off-by: Keerthy <j-keerthy at ti.com>
> >> ---
> >> net/eth-uclass.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> >> index 2ef20df192..26f7e0b8cd 100644
> >> --- a/net/eth-uclass.c
> >> +++ b/net/eth-uclass.c
> >> @@ -531,7 +531,8 @@ static int eth_pre_remove(struct udevice *dev)
> >> {
> >> struct eth_pdata *pdata = dev->platdata;
> >>
> >> - eth_get_ops(dev)->stop(dev);
> >> + if (eth_is_active(dev))
> >> + eth_get_ops(dev)->stop(dev);
> >
> > This seems reasonable... What was the case that provoked an issue?
> > Which driver was having trouble?
>
> I am trying to implement pru based ethernet driver(multiple instances)
> with cpsw driver on top on am654-evm. I observed that even though i had
> not started
> a particular instance of my pru based device stop was getting called and
> it was crashing right at the end.
>
Please add a proper test case in test/dm/eth.c to cover such scenarios. Thanks!
Regards,
Bin
More information about the U-Boot
mailing list