diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index 5e9079da048784c1b01897c9e42f2e14a1a73232..7ef7532a502a01c955339f28269dc3fcee342c59 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -314,6 +314,11 @@ static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			mask = simple_strtoul(argv[5], NULL, 16);
 	}
 
+	if (addrhi > 31) {
+		printf("Incorrect PHY address. Range should be 0-31\n");
+		return CMD_RET_USAGE;
+	}
+
 	/* use current device */
 	devname = miiphy_get_current_dev();