/* Check device number to be within valid range for given device type. */
int mtd_device_validate(u8 type, u8 num, u32 *size)
/* Check device number to be within valid range for given device type. */
int mtd_device_validate(u8 type, u8 num, u32 *size)
{
	struct mtd_info *mtd;
	char mtd_dev[16];
	sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(type), num);
	mtd = get_mtd_device_nm(mtd_dev);
	if (IS_ERR(mtd)) {
		printf("Device %s not found!\n", mtd_dev);
		return 1;
	}
	*size = mtd->size;
	return 0;
}