/* This function returns %0 in case of success, %-EINVAL if the UBI device number is invalid, and %-ENODEV if there is no such UBI device.  */
int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
/* This function returns %0 in case of success, %-EINVAL if the UBI device number is invalid, and %-ENODEV if there is no such UBI device.  */
int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
{
	struct ubi_device *ubi;
	if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)
		return -EINVAL;
	ubi = ubi_get_device(ubi_num);
	if (!ubi)
		return -ENODEV;
	ubi_do_get_device_info(ubi, di);
	ubi_put_device(ubi);
	return 0;
}