vduse: store control device pointer

This helps log the errors in next patches.  The alternative is to
perform a linear search for it with class_find_device_by_devt(class, devt),
as device_destroy do for cleaning.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260707122502.239022-2-eperezma@redhat.com>
This commit is contained in:
Eugenio Pérez 2026-07-07 14:24:59 +02:00 committed by Michael S. Tsirkin
parent 05d32474ab
commit 0ff906166f

View File

@ -163,6 +163,7 @@ static DEFINE_IDR(vduse_idr);
static dev_t vduse_major;
static struct cdev vduse_ctrl_cdev;
static const struct device *vduse_ctrl_dev;
static struct cdev vduse_cdev;
static struct workqueue_struct *vduse_irq_wq;
static struct workqueue_struct *vduse_irq_bound_wq;
@ -2531,7 +2532,6 @@ static void vduse_mgmtdev_exit(void)
static int vduse_init(void)
{
int ret;
struct device *dev;
ret = class_register(&vduse_class);
if (ret)
@ -2548,9 +2548,10 @@ static int vduse_init(void)
if (ret)
goto err_ctrl_cdev;
dev = device_create(&vduse_class, NULL, vduse_major, NULL, "control");
if (IS_ERR(dev)) {
ret = PTR_ERR(dev);
vduse_ctrl_dev = device_create(&vduse_class, NULL, vduse_major, NULL, "control");
if (IS_ERR(vduse_ctrl_dev)) {
ret = PTR_ERR(vduse_ctrl_dev);
vduse_ctrl_dev = NULL;
goto err_device;
}