/* This function returns zero in case of success and a negative error code in case of failure.  */
static int ubi_sysfs_init(struct ubi_device *ubi, int *ref)
/* This function returns zero in case of success and a negative error code in case of failure.  */
static int ubi_sysfs_init(struct ubi_device *ubi, int *ref)
{
	int err;
	ubi->dev.release = dev_release;
	ubi->dev.devt = ubi->cdev.dev;
	ubi->dev.class = &ubi_class;
	ubi->dev.groups = ubi_dev_groups;
	dev_set_name(&ubi->dev, UBI_NAME_STR"%d", ubi->ubi_num);
	err = device_register(&ubi->dev);
	if (err)
		return err;
	*ref = 1;
	return 0;
}