From patchwork Sat Jul 30 06:32:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9253063 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3600F6075F for ; Sat, 30 Jul 2016 06:32:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A648281F9 for ; Sat, 30 Jul 2016 06:32:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7A628441; Sat, 30 Jul 2016 06:32:47 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 A42FC281F9 for ; Sat, 30 Jul 2016 06:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750784AbcG3Gco (ORCPT ); Sat, 30 Jul 2016 02:32:44 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33167 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbcG3Gcn (ORCPT ); Sat, 30 Jul 2016 02:32:43 -0400 Received: by mail-pa0-f67.google.com with SMTP id q2so6320911pap.0 for ; Fri, 29 Jul 2016 23:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IM5iZHtGQ1h7q+IWvJ+D1Q7zcEXwgCTqjaUG4sbvTmE=; b=YLTJzj2xjhC5xqzFnCIrQXz1hbJcD9q22zS8QX/fcw0bPytHsD+prD7+Vfglch5RdI V87i3R6IBIdQ7ftlPnO/nL2nqIoOQmXd5MjN8drtbUXmsSv3CNfn5AcrCzCcxSw+e6vz XssbvFG+oQ/iPyj+La8tE55FZJyCxLYCalKjXqoj0rvcvjdrtfjFEYiXghXH6SAHcR4A Kud+uGSZ4Qj0wbdmo6bg1rAY5DBclbQ/xn1kkDh3iYmrPtHOdJR3Z2W+FHZ2R0Ebcm9x vpEr9azFvAGWltItge0+j89anbcUgu9cC+sQnhWA+RNiWSFPLz7Ng1fB3cd/ed/qSXrm ciMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IM5iZHtGQ1h7q+IWvJ+D1Q7zcEXwgCTqjaUG4sbvTmE=; b=KFRl8vERJ1Rsv2D1phkgXbaUQsGBfCflr1poQZGg4d+HkH7vw0yGKfbRXH59udyTjc IxQmorseEyoVUhe+805NVAt+UchxDYujFw5j1LR9FNvFlfxvmehPJf5UzU4eZyhl11UV 6PP6xOHtIZR3nJipOTDcllJ5Ep9i/FmHTwHA5MmetzhIIMRfqCV6VwKP58FIrNyQTgqN 8AbB57HE8tkPUuDXCt/eDAl30G2V9YEcNaPTjJJeYCcks5KV0PMww4MK51cL14Uza/OZ 6xjXkAMY0EwFUn1g+IV+Dn/amDrvHuYACNfHK46O+k426XwSygMEag74BRAhMJpjD3ZR dAEA== X-Gm-Message-State: AEkooutNzrmzA74cpBde3ZcL4UoaL8wDBm6L0LgLbenzOqU5dwF2TBYkvpF+4QEu8AYNhw== X-Received: by 10.66.138.108 with SMTP id qp12mr75114761pab.65.1469860363030; Fri, 29 Jul 2016 23:32:43 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id 71sm29403619pfy.32.2016.07.29.23.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 23:32:42 -0700 (PDT) From: Wei Yongjun To: Zhang Rui , Eduardo Valentin , Lina Iyer , Rajendra Nayak Cc: Wei Yongjun , linux-pm@vger.kernel.org Subject: [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common() Date: Sat, 30 Jul 2016 06:32:37 +0000 Message-Id: <1469860357-2773-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. And the function devm_regmap_init_mmio() 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 Acked-by: Rajendra Nayak --- drivers/thermal/qcom/tsens-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 4a1af15..b1449ad 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -128,13 +128,13 @@ int __init init_common(struct tsens_device *tmdev) void __iomem *base; base = of_iomap(tmdev->dev->of_node, 0); - if (IS_ERR(base)) + if (!base) return -EINVAL; tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); - if (!tmdev->map) { + if (IS_ERR(tmdev->map)) { iounmap(base); - return -ENODEV; + return PTR_ERR(tmdev->map); } return 0;