cmd: mdio: prevent data abort when no mdio bus is found
authorSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Fri, 12 Jul 2019 18:58:18 +0000 (20:58 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 18 Jul 2019 21:37:13 +0000 (16:37 -0500)
commitcb58d18beb3cd65b66c20f913cb55c38c322457b
tree8afb0fdd3ae4c87d9cd880e1e137eff2fb8f9efd
parentc3d9f3f899038e21a66e1e4a685abc0a5a1d5d9c
cmd: mdio: prevent data abort when no mdio bus is found

Calling 'mdio read ...' currently leads to a data abort when no mdio
bus is found.

To fix this, check if 'bus' is a valid pointer before accessing it.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Tested-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
cmd/mdio.c