Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCA3BC43381 for ; Sat, 16 Feb 2019 01:22:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9979222A1 for ; Sat, 16 Feb 2019 01:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732174AbfBPBV7 (ORCPT ); Fri, 15 Feb 2019 20:21:59 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:56976 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726125AbfBPBV6 (ORCPT ); Fri, 15 Feb 2019 20:21:58 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A8C3DB8ED652A6178B39; Sat, 16 Feb 2019 09:21:56 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Sat, 16 Feb 2019 09:21:48 +0800 From: Wei Yongjun To: Arnd Bergmann , Greg Kroah-Hartman CC: Wei Yongjun , , Subject: [PATCH -next] misc: fastrpc: Fix return value check in fastrpc_map_create() Date: Sat, 16 Feb 2019 01:35:43 +0000 Message-ID: <20190216013543.117431-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Signed-off-by: Wei Yongjun --- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4b0db33896df..7edceaa6adaa 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -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; }