Skip to contentSkip to conversation

misc: fastrpc: Fix return value check in fastrpc_map_create()

PATCH New Wei Yongjun 1 participant 1 message Feb 16, 2019

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

PATCH 1/1 misc: fastrpc: Fix return value check in fastrpc_map_create()

In case of error, the function dma_buf_get() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

---
 drivers/misc/fastrpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/fastrpc.c +2 -2
index 4b0db33896df..7edceaa6adaa 100644
@@ -496,8 +496,8 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd,
 	map->fl = fl;
 	map->fd = fd;
 	map->buf = dma_buf_get(fd);
-	if (!map->buf) {
-		err = -EINVAL;
+	if (IS_ERR(map->buf)) {
+		err = PTR_ERR(map->buf);
 		goto get_err;
 	}