From patchwork Mon Sep 4 19:56:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 111604 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp1935182qge; Mon, 4 Sep 2017 12:57:45 -0700 (PDT) X-Received: by 10.99.54.7 with SMTP id d7mr1568612pga.115.1504555064915; Mon, 04 Sep 2017 12:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504555064; cv=none; d=google.com; s=arc-20160816; b=DP2uqDQyF0ecmjuCuKH/d6qEAeU9qGVZIFqAb5f+aYPk+h6s+K5ST4c+8zQ6/Iccpc FDQcWMh+i5Kqi+SBuFoeJ4+xfFQlx4vDPF+qy4XztRUHKRR+n1pCAfgDujUN+0vJIQpX mp7w29onrkkHWBQ22MNrTkB5aGjxP+uxyXlwY1eQsqB4seBF8Ikm3EcXrLaJEeLtZ5oq MrGnHrQQWoM1gKcrVMw1b1rNn9DE1ePQczrOcEKLw76fW/Nkqul42LZ5PFansI3o6OYA C7Wz/muu74GCUU7Sh5DKgCbwbzejqo6+s3gH+ejuC988bTfE/nz6JFuob/w6DtsSi2B6 Umyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7xBEhVPaCblnkIL+P8vAWg4HSWgZbmZtlo3bOYLNLEA=; b=0PCPGDTq9aRDmXhsr0yb+QoQ2CDkXEB1hqwgARnTvurumpNj8jcmUyoKd/vl737NYi Dy5xd3IYzYtCexn3+UK2iLrM6BtF4t+ryuSb7mkyeDbuxSLeQFYR2qYorFJBQB2KxBeH l6vkkx8nGoAAsQdrxe4WGsC5gGncyWJHLUYibUkBQflC3ns/8KqF/5Dudah+C3df11n0 7xCT1pa1IIJs9OFCJ/mc3gSQno49LcpTaXT0FuFVGap0g/yNyVC/py35W9sxgbaCb0az gXptbdkuBByoqz50cq4FrOoyCgi7dUKBcokuIxmbyK5ffAoJpYAKovnzow9YblbRrLD9 6qKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E628kOng; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si5872932plk.360.2017.09.04.12.57.44; Mon, 04 Sep 2017 12:57:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E628kOng; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754010AbdIDT5k (ORCPT + 12 others); Mon, 4 Sep 2017 15:57:40 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:36292 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753988AbdIDT5h (ORCPT ); Mon, 4 Sep 2017 15:57:37 -0400 Received: by mail-wr0-f170.google.com with SMTP id p14so2065229wrg.3 for ; Mon, 04 Sep 2017 12:57:36 -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=7xBEhVPaCblnkIL+P8vAWg4HSWgZbmZtlo3bOYLNLEA=; b=E628kOngR8LJeCT0rFlYJpmyUYqd8yMBZx28kPASN0vZk4q55S9GNk4A1HcTuyG4Fz k1DvExarOEZ7EAKPUabibBwueXUoc3wCJAYDbbMlxDqKgI56bJb8NZ4MLKN2JA9Qxggf awGrxr0SWsX20mU2MvC5cSpQ9mgpa0qSFfolg= 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=7xBEhVPaCblnkIL+P8vAWg4HSWgZbmZtlo3bOYLNLEA=; b=CpBQw0+5ARS8JECa9yIs+tsa8soArAt+vEqkSCryMqGKvnHWfOerS6L0ljYfTXaacr BJxA4Ee/zt86Uf9IHKJ7rNAWVWqpeQpWqu054e//ZAlilQtgsbS4URZbdepZvNm4mbX1 6boTgSbbnyrv4OZjldRvBIOsE0H5odzEHabFMcZd1PaxEv3zpIw0hU+Ax98W4OSIvu7N NYr5d06Cf2ihhcnHTc+CVv8VB2rhI2mh68SnSqMg8aBPRM/C1ytmTbFo9IQ5wKlP+dmi etf0RWl48SvoBw9cnq2q/VnJAuGAzjo9EWNG9njYK2IkunKB5A4Mt8stkOwTgTV3LSxY I1TQ== X-Gm-Message-State: AHPjjUgQNdmwFbMOZWxATHBhtRheMIEOYcCZiH1ZIAYDlFdEJludhe1z sXGjMKBrFWZ/IxGh X-Google-Smtp-Source: ADKCNb7BoQdNcM+0+iQifdjITlo9DOh+q7+DIq9cfYMNnXiCy9cuV3ruvmFp013SJgazNyGJco1SDg== X-Received: by 10.223.184.230 with SMTP id c35mr988577wrg.313.1504555056020; Mon, 04 Sep 2017 12:57:36 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:f567:7c41:be9d:9286]) by smtp.gmail.com with ESMTPSA id 23sm10798976wrt.44.2017.09.04.12.57.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Sep 2017 12:57:35 -0700 (PDT) From: Daniel Lezcano To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, kevin.wangtao@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 03/13] thermal/drivers/hisi: Fix kernel panic on alarm interrupt Date: Mon, 4 Sep 2017 21:56:02 +0200 Message-Id: <1504554972-2624-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504554972-2624-1-git-send-email-daniel.lezcano@linaro.org> References: <1504554972-2624-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 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(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 725d0d4..f69aea0 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;