From 7ca96aa278f8b9983184e318b06a0ed9ad0297b8 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Wed, 19 Feb 2014 17:35:49 +0200 Subject: mei: make return values consistent across the driver 1. Propagate ENOTTY to user space if the client is not present in the system 2. Use ETIME consistently on timeouts 3. Return EIO on write failures 4. Return ENODEV on recoverable device failures such as resets Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/amthif.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/misc/mei/amthif.c') diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index bff9a07f1af5..f05d54d15e2f 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c @@ -78,10 +78,9 @@ int mei_amthif_host_init(struct mei_device *dev) i = mei_me_cl_by_uuid(dev, &mei_amthif_guid); if (i < 0) { - ret = i; dev_info(&dev->pdev->dev, - "amthif: failed to find the client %d\n", ret); - return ret; + "amthif: failed to find the client %d\n", i); + return -ENOTTY; } cl->me_client_id = dev->me_clients[i].client_id; @@ -174,14 +173,13 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, /* Only possible if we are in timeout */ if (!cl || cl != &dev->iamthif_cl) { dev_dbg(&dev->pdev->dev, "bad file ext.\n"); - return -ETIMEDOUT; + return -ETIME; } i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); - if (i < 0) { dev_dbg(&dev->pdev->dev, "amthif client not found.\n"); - return -ENODEV; + return -ENOTTY; } dev_dbg(&dev->pdev->dev, "checking amthif data\n"); cb = mei_amthif_find_read_list_entry(dev, file); @@ -222,7 +220,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, dev_dbg(&dev->pdev->dev, "amthif Time out\n"); /* 15 sec for the message has expired */ list_del(&cb->list); - rets = -ETIMEDOUT; + rets = -ETIME; goto free; } } -- cgit v1.2.3