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>
diff --git a/cmd/mdio.c b/cmd/mdio.c
index a6fa926..add6440 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -268,6 +268,11 @@
 		break;
 	}
 
+	if (!bus) {
+		puts("No MDIO bus found\n");
+		return CMD_RET_FAILURE;
+	}
+
 	if (op[0] == 'l') {
 		mdio_list_devices();