diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-09-17 00:44:46 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-04 03:00:52 +0400 |
commit | e036cc5727eb6d471442d2a9218990aa11215400 (patch) | |
tree | 0eb7788e41d4631828374da6320fadd85fa1b93a /drivers/misc/mei/client.c | |
parent | d7173493683853047d6efc8d4454c70469a7b033 (diff) | |
download | linux-e036cc5727eb6d471442d2a9218990aa11215400.tar.xz |
mei: simplify mei_open error handling
1. Perform simple checks first and only then attempt to allocate cl structure.
2. Remove open_handler_count test, this is already checked in mei_cl_link function
3. return -EMFILE instead of -ENOENT as expected by user space
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index fbd319c506e6..88770e040dd1 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -288,7 +288,13 @@ int mei_cl_link(struct mei_cl *cl, int id) if (id >= MEI_CLIENTS_MAX) { dev_err(&dev->pdev->dev, "id exceded %d", MEI_CLIENTS_MAX) ; - return -ENOENT; + return -EMFILE; + } + + if (dev->open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) { + dev_err(&dev->pdev->dev, "open_handle_count exceded %d", + MEI_MAX_OPEN_HANDLE_COUNT); + return -EMFILE; } if (dev->open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) { |