Skip to contentSkip to conversation

Staging: rtl8723bs: fix an error code in isFileReadable()

PATCH New Dan Carpenter 1 participant 1 message Jun 14, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8723bs: fix an error code in isFileReadable()

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")
drivers/staging/rtl8723bs/os_dep/osdep_service.c +1 -1
index 02db59e8b593..aa16d1ab955b 100644
@@ -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);