aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 369de0a070f1..10fc3a6a1574 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -59,24 +59,18 @@ static int mei_open(struct inode *inode, struct file *file)
59 59
60 mutex_lock(&dev->device_lock); 60 mutex_lock(&dev->device_lock);
61 61
62 cl = NULL;
63
64 err = -ENODEV;
65 if (dev->dev_state != MEI_DEV_ENABLED) { 62 if (dev->dev_state != MEI_DEV_ENABLED) {
66 dev_dbg(dev->dev, "dev_state != MEI_ENABLED dev_state = %s\n", 63 dev_dbg(dev->dev, "dev_state != MEI_ENABLED dev_state = %s\n",
67 mei_dev_state_str(dev->dev_state)); 64 mei_dev_state_str(dev->dev_state));
65 err = -ENODEV;
68 goto err_unlock; 66 goto err_unlock;
69 } 67 }
70 68
71 err = -ENOMEM; 69 cl = mei_cl_alloc_linked(dev, MEI_HOST_CLIENT_ID_ANY);
72 cl = mei_cl_allocate(dev); 70 if (IS_ERR(cl)) {
73 if (!cl) 71 err = PTR_ERR(cl);
74 goto err_unlock;
75
76 /* open_handle_count check is handled in the mei_cl_link */
77 err = mei_cl_link(cl, MEI_HOST_CLIENT_ID_ANY);
78 if (err)
79 goto err_unlock; 72 goto err_unlock;
73 }
80 74
81 file->private_data = cl; 75 file->private_data = cl;
82 76
@@ -86,7 +80,6 @@ static int mei_open(struct inode *inode, struct file *file)
86 80
87err_unlock: 81err_unlock:
88 mutex_unlock(&dev->device_lock); 82 mutex_unlock(&dev->device_lock);
89 kfree(cl);
90 return err; 83 return err;
91} 84}
92 85