Staging: rtl8723bs: fix an error code in isFileReadable()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 09:10:56 +0000 (12:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2017 10:43:54 +0000 (12:43 +0200)
The caller only cares about zero vs non-zero so this code actually works
fine but we should be returning a negative error code instead of a valid
pointer casted to int.

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/os_dep/osdep_service.c

index 02db59e8b593309e6e4b161d977178947cd24c57..aa16d1ab955b43ae57c1a317beb365b2cfd2d476 100644 (file)
@@ -160,7 +160,7 @@ static int isFileReadable(char *path)
                oldfs = get_fs(); set_fs(get_ds());
 
                if (1!=readFile(fp, &buf, 1))
-                       ret = PTR_ERR(fp);
+                       ret = -EINVAL;
 
                set_fs(oldfs);
                filp_close(fp, NULL);