From patchwork Tue Oct 10 18:02:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 9996983 X-Patchwork-Delegate: eduardo.valentin@ti.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 1F39B60216 for ; Tue, 10 Oct 2017 18:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16CBF28706 for ; Tue, 10 Oct 2017 18:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BBFE2870F; Tue, 10 Oct 2017 18:14:02 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable 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 B806A28706 for ; Tue, 10 Oct 2017 18:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756533AbdJJSE4 (ORCPT ); Tue, 10 Oct 2017 14:04:56 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:48914 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756347AbdJJSEw (ORCPT ); Tue, 10 Oct 2017 14:04:52 -0400 Received: by mail-wm0-f41.google.com with SMTP id i124so7421253wmf.3 for ; Tue, 10 Oct 2017 11:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b1XO1Q6oDJ+0Zqsb1mpoVsrFtWrFMVdCtEDLzYWAduw=; b=RGSJ2dLEn2tnnP6ck9LJSVhlcnwcGdFpjo8wlKzle9+MhGuET7dqsgTto064+BHfxU 70eKK1TrT0jsmG/1nvE7KKN/745DI+cWjG52ndVQIDsRNNEdrsq8mRnoTRs0OnA708DZ Q5OTvzFKU9Hz7tRzT0DGytWnLKOhB1MQlWcDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b1XO1Q6oDJ+0Zqsb1mpoVsrFtWrFMVdCtEDLzYWAduw=; b=dkmHVW0BS0ReWkn/kz6KWJRR5PyUd/uiZioeqCm02ESJ5k1ZDq0ooEzBmoQ5QtWxUI umukB/vNbf8SnaS0KEtu3gSNojJMcEdFRI/q4FLbghgp3f/Ft0gsYjjB4cIuJXpkcj53 VdWpEZK7R7FsfQlk3a9IR3ucl/Axum3rByae2izZ42ivsLiTOe3BFvDJ0DXEiVSWORvQ hzfhVpbQzEzRq1hHq+obSMU94aScwgIBZRUcXUQVBpZOnX2SN5IVps5cstsl+QU4jruC 7Vmgxw19DTzStzOftR7K/aDpVkSXXEUyG7SAt/9DsnKi+r4YNlDpdIJ+GVV6DIokDb9o Y9Jg== X-Gm-Message-State: AMCzsaXL8RrS4WY+DKHYqJGPs/JARz6fdmQ2a/fHaDxbj7UO+Zd6jwe4 +i7ottKWYjgPehZZsPJwUrUZZ5E4yAg= X-Google-Smtp-Source: AOwi7QDtvhIeFItGV8n2b1lq7//u58BX+DoRpUCyhrc5EwHob40+ZHvgsPSFcpi+sFj2l2N/4lbPCA== X-Received: by 10.223.197.201 with SMTP id v9mr6451009wrg.82.1507658691603; Tue, 10 Oct 2017 11:04:51 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:4f9:3ae1:43d2:31ae]) by smtp.gmail.com with ESMTPSA id l73sm12513428wmd.47.2017.10.10.11.04.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 11:04:51 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kevin.wangtao@linaro.org, Leo Yan Subject: [PATCH 03/25] thermal/drivers/hisi: Fix kernel panic on alarm interrupt Date: Tue, 10 Oct 2017 20:02:28 +0200 Message-Id: <1507658570-32675-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> References: <79a5f10c-0fb7-3e4f-caac-c1625904b137@linaro.org> <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> 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 The threaded interrupt for the alarm interrupt is requested before the temperature controller is setup. This one can fire an interrupt immediately leading to a kernel panic as the sensor data is not initialized. In order to prevent that, move the threaded irq after the Tsensor is setup. Signed-off-by: Daniel Lezcano Reviewed-by: Leo Yan Tested-by: Leo Yan --- drivers/thermal/hisi_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 687efd4..feae552 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -287,15 +287,6 @@ static int hisi_thermal_probe(struct platform_device *pdev) if (data->irq < 0) return data->irq; - ret = devm_request_threaded_irq(&pdev->dev, data->irq, - hisi_thermal_alarm_irq, - hisi_thermal_alarm_irq_thread, - 0, "hisi_thermal", data); - if (ret < 0) { - dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); - return ret; - } - platform_set_drvdata(pdev, data); data->clk = devm_clk_get(&pdev->dev, "thermal_clk"); @@ -328,6 +319,15 @@ static int hisi_thermal_probe(struct platform_device *pdev) hisi_thermal_toggle_sensor(&data->sensors, true); + ret = devm_request_threaded_irq(&pdev->dev, data->irq, + hisi_thermal_alarm_irq, + hisi_thermal_alarm_irq_thread, + 0, "hisi_thermal", data); + if (ret < 0) { + dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); + return ret; + } + enable_irq(data->irq); return 0;