From patchwork Wed Sep 7 09:24:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 9318691 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 00FE3601C0 for ; Wed, 7 Sep 2016 09:25:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA74E29086 for ; Wed, 7 Sep 2016 09:25:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF1822908D; Wed, 7 Sep 2016 09:25:20 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78D1C29086 for ; Wed, 7 Sep 2016 09:25:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhZ6e-0000tZ-4t; Wed, 07 Sep 2016 09:25:20 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhZ6b-0000AV-TZ for linux-mediatek@lists.infradead.org; Wed, 07 Sep 2016 09:25:18 +0000 Received: by mail-pa0-x241.google.com with SMTP id pp5so634167pac.2 for ; Wed, 07 Sep 2016 02:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=UzyCq5omj8qnGDxItb60fKgMD6u16jD84ukSyEMvJ7I=; b=LApS503Gcp8xG3NY9oqr1t2Es6n9frpjWhn8oWtGX55WW0EVIkP6RXLkojximZu1oO 6fgzKkTBKChFwRg54KSIh4v6R4vguasl1M6fao6W4giQg7V5VxTyB2Z9so4DlrSVnCZs zDrlECl+zrUkms8zwAIsyyrYPDsBPcsNkq5x5WnLNyipzfQFInOlsevjLhdwK4NLyzVN IM6Vl2IhQQmrRb4SkQLLHyzktkBmtyuHwFQrRJpDar4A6iuxCM5ueSLjGHKWYidoWzZn ZYHnGYWU4GJE2tw85ccTAifDmC8vC9KrFJs1I6z0JFvdo2PIAvIHaqIuFEIKtWYWktm9 Ncrg== 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; bh=UzyCq5omj8qnGDxItb60fKgMD6u16jD84ukSyEMvJ7I=; b=HCuTmbTurkQc87YyW6zeYbUGMZWnKnSMZAzWjgTe4DQ4TWrYloRP8czbI3vub+Nb4f sOJmJIUhZH1gddF1Bmn/+4sTyHGX1FAD/NKM5jZne+3mtVLEeBWFXCAq24CWDnY3eQpv 41oHmW6J6suG7gf5oXQOotzji7PxMxCg6wiyB5qxZsA/AMAdB1ldby/HKEN54iV1bAIt IyOBeX7l+rfTkut9QubuiiNxmDVhPN8ULGhUEle3jboh7pbht9/FFQZ8MFSEffdb7gJw u5eXXRFcbgdYtCrroCJz8PuIWR9Oo0mMo4e9KL56ZzRCjw+/iusf3a2W8yqQJd8AlSv+ ngDw== X-Gm-Message-State: AE9vXwM+YHgEYb5q599QCb3C6o8i3MxOxMf5XH9MnKZMtw/8q5zp6Y3mbHqkkhq56Y02bQ== X-Received: by 10.66.25.8 with SMTP id y8mr80224793paf.64.1473240301474; Wed, 07 Sep 2016 02:25:01 -0700 (PDT) Received: from localhost.localdomain (118-167-16-240.dynamic.hinet.net. [118.167.16.240]) by smtp.gmail.com with ESMTPSA id p17sm6463856pfi.7.2016.09.07.02.24.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Sep 2016 02:25:00 -0700 (PDT) From: Axel Lin To: Zhang Rui Subject: [PATCH] thermal: mtk_thermal: Check return value of devm_thermal_zone_of_sensor_register Date: Wed, 7 Sep 2016 17:24:52 +0800 Message-Id: <1473240292-10116-1-git-send-email-axel.lin@ingics.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160907_022518_058922_CAB09E87 X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Valentin , Matthias Brugger , Axel Lin , linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP devm_thermal_zone_of_sensor_register can fail, so check it's return value. Signed-off-by: Axel Lin Reviewed-by: Matthias Brugger --- drivers/thermal/mtk_thermal.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 7b233c7..34169c3 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -584,6 +584,7 @@ static int mtk_thermal_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *of_id; u64 auxadc_phys_base, apmixed_phys_base; + struct thermal_zone_device *tzdev; mt = devm_kzalloc(&pdev->dev, sizeof(*mt), GFP_KERNEL); if (!mt) @@ -666,11 +667,17 @@ static int mtk_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mt); - devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, - &mtk_thermal_ops); + tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt, + &mtk_thermal_ops); + if (IS_ERR(tzdev)) { + ret = PTR_ERR(tzdev); + goto err_disable_clk_peri_therm; + } return 0; +err_disable_clk_peri_therm: + clk_disable_unprepare(mt->clk_peri_therm); err_disable_clk_auxadc: clk_disable_unprepare(mt->clk_auxadc);