pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
- if (of_id)
+ if (of_id) {
dev->devtype = of_id->data;
- else if (pdev_id)
+ } else if (pdev_id) {
dev->devtype = &coda_devdata[pdev_id->driver_data];
- else
- return -EINVAL;
+ } else {
+ ret = -EINVAL;
+ goto err_v4l2_register;
+ }
spin_lock_init(&dev->irqlock);
INIT_LIST_HEAD(&dev->instances);
dev->debugfs_root);
if (ret < 0) {
dev_err(&pdev->dev, "failed to allocate work buffer\n");
- v4l2_device_unregister(&dev->v4l2_dev);
- return ret;
+ goto err_v4l2_register;
}
}
dev->debugfs_root);
if (ret < 0) {
dev_err(&pdev->dev, "failed to allocate temp buffer\n");
- v4l2_device_unregister(&dev->v4l2_dev);
- return ret;
+ goto err_v4l2_register;
}
}
pm_runtime_enable(&pdev->dev);
return coda_firmware_request(dev);
+
+err_v4l2_register:
+ v4l2_device_unregister(&dev->v4l2_dev);
+ return ret;
}
static int coda_remove(struct platform_device *pdev)