summaryrefslogtreecommitdiffstats
path: root/drivers/staging/mei
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2011-11-13 09:41:15 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-26 16:05:14 -0800
commit6f37aca827e6d075c9e9d3ab1b233cce2a3bc9f1 (patch)
tree1f9ee8eb97c59067abcea271a8e4209f8920c6bf /drivers/staging/mei
parent5b881e3c08a8041604bd60117cca22e1ff026e9b (diff)
downloadop-kernel-dev-6f37aca827e6d075c9e9d3ab1b233cce2a3bc9f1.zip
op-kernel-dev-6f37aca827e6d075c9e9d3ab1b233cce2a3bc9f1.tar.gz
staging/mei: fix check for allocating host client id
MEI_CLIENTS_MAX is 255 and host_client_id is u8 therefore for check to work we need to first assign the return value of find_first_zero_bit to unsigned long variable Fix warning drivers/staging/mei/main.c: In function mei_open drivers/staging/mei/main.c:260:2: warning: comparison is always false due to limited range of data type Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/mei')
-rw-r--r--drivers/staging/mei/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c
index 410b5d4..1ea04b3 100644
--- a/drivers/staging/mei/main.c
+++ b/drivers/staging/mei/main.c
@@ -228,8 +228,9 @@ static struct mei_cl_cb *find_read_list_entry(
static int mei_open(struct inode *inode, struct file *file)
{
struct mei_cl *cl;
- int err;
struct mei_device *dev;
+ unsigned long cl_id;
+ int err;
err = -ENODEV;
if (!mei_device)
@@ -255,14 +256,16 @@ static int mei_open(struct inode *inode, struct file *file)
if (dev->open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT)
goto out_unlock;
- cl->host_client_id = find_first_zero_bit(dev->host_clients_map,
- MEI_CLIENTS_MAX);
- if (cl->host_client_id > MEI_CLIENTS_MAX)
+ cl_id = find_first_zero_bit(dev->host_clients_map, MEI_CLIENTS_MAX);
+ if (cl_id >= MEI_CLIENTS_MAX)
goto out_unlock;
+ cl->host_client_id = cl_id;
+
dev_dbg(&dev->pdev->dev, "client_id = %d\n", cl->host_client_id);
dev->open_handle_count++;
+
list_add_tail(&cl->link, &dev->file_list);
set_bit(cl->host_client_id, dev->host_clients_map);
OpenPOWER on IntegriCloud