From patchwork Wed Oct 10 03:59:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10633905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9E4316B1 for ; Wed, 10 Oct 2018 03:48:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6EC029527 for ; Wed, 10 Oct 2018 03:48:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB1982952E; Wed, 10 Oct 2018 03:48:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BFA529527 for ; Wed, 10 Oct 2018 03:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbeJJLIn (ORCPT ); Wed, 10 Oct 2018 07:08:43 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13610 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725860AbeJJLIm (ORCPT ); Wed, 10 Oct 2018 07:08:42 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A5219C1F4BBDD; Wed, 10 Oct 2018 11:48:27 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Wed, 10 Oct 2018 11:48:23 +0800 From: Wei Yongjun To: Ohad Ben-Cohen , Bjorn Andersson , Rohit kumar CC: Wei Yongjun , , Subject: [PATCH -next] remoteproc: qcom: qcom_q6v5_adsp: Fix some return value check Date: Wed, 10 Oct 2018 03:59:39 +0000 Message-ID: <1539143979-82369-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the functions devm_kcalloc() and devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Also removed -EPROBE_DEFER check since devm_kcalloc never return this error. Fixes: dc160e449122 ("remoteproc: qcom: Introduce Non-PAS ADSP PIL driver") Signed-off-by: Wei Yongjun --- drivers/remoteproc/qcom_q6v5_adsp.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 3285a8b..79374d1 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -295,12 +295,8 @@ static int adsp_init_clock(struct qcom_adsp *adsp) adsp->num_clks = ARRAY_SIZE(adsp_clk_id); adsp->clks = devm_kcalloc(adsp->dev, adsp->num_clks, sizeof(*adsp->clks), GFP_KERNEL); - if (IS_ERR(adsp->clks)) { - ret = PTR_ERR(adsp->clks); - if (ret != -EPROBE_DEFER) - dev_err(adsp->dev, "failed to get adsp clock"); - return ret; - } + if (!adsp->clks) + return -ENOMEM; for (i = 0; i < adsp->num_clks; i++) adsp->clks[i].id = adsp_clk_id[i]; @@ -337,9 +333,9 @@ static int adsp_init_mmio(struct qcom_adsp *adsp, res = platform_get_resource(pdev, IORESOURCE_MEM, 0); adsp->qdsp6ss_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); - if (IS_ERR(adsp->qdsp6ss_base)) { + if (!adsp->qdsp6ss_base) { dev_err(adsp->dev, "failed to map QDSP6SS registers\n"); - return PTR_ERR(adsp->qdsp6ss_base); + return -ENOMEM; } syscon = of_parse_phandle(pdev->dev.of_node, "qcom,halt-regs", 0);