Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723128

[PATCH 03/13] thermal/drivers/hisi: Fix kernel panic on alarm interrupt

From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 03/13] thermal/drivers/hisi: Fix kernel panic on alarm interrupt
Date 2017-08-30 11:00 +0200
Message-ID <uk70R-66H-9@gated-at.bofh.it> (permalink)
References <uk6Rb-63h-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <daniel.lezcano@linaro.org>
---
 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 92b6889..67db523 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;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/13] thermal/drivers/hisi: Fix missing interrupt enablement Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 10:50 +0200
  [PATCH 02/13] thermal/drivers/hisi: Remove the multiple sensors support Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 10:50 +0200
    Re: [PATCH 02/13] thermal/drivers/hisi: Remove the multiple sensors  support Leo Yan <leo.yan@linaro.org> - 2017-09-01 16:10 +0200
      Re: [PATCH 02/13] thermal/drivers/hisi: Remove the multiple sensors  support Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-09-01 22:50 +0200
  [PATCH 06/13] thermal/drivers/hisi: Remove pointless lock Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 11:00 +0200
    Re: [PATCH 06/13] thermal/drivers/hisi: Remove pointless lock Leo Yan <leo.yan@linaro.org> - 2017-09-01 16:50 +0200
  [PATCH 03/13] thermal/drivers/hisi: Fix kernel panic on alarm interrupt Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 11:00 +0200
    Re: [PATCH 03/13] thermal/drivers/hisi: Fix kernel panic on alarm  interrupt Leo Yan <leo.yan@linaro.org> - 2017-09-01 16:20 +0200
  [PATCH 08/13] thermal/drivers/hisi: Fix configuration register setting Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 11:00 +0200
    Re: [PATCH 08/13] thermal/drivers/hisi: Fix configuration register  setting Leo Yan <leo.yan@linaro.org> - 2017-09-02 05:00 +0200
      Re: [PATCH 08/13] thermal/drivers/hisi: Fix configuration register  setting Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-09-02 10:40 +0200
        Re: [PATCH 08/13] thermal/drivers/hisi: Fix configuration register  setting Leo Yan <leo.yan@linaro.org> - 2017-09-04 03:00 +0200
          Re: [PATCH 08/13] thermal/drivers/hisi: Fix configuration register  setting Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-09-04 11:20 +0200
  [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor inspection Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 11:00 +0200
    Re: [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor  inspection Leo Yan <leo.yan@linaro.org> - 2017-09-02 05:30 +0200
      Re: [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor  inspection Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-09-02 15:20 +0200
        Re: [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor  inspection Leo Yan <leo.yan@linaro.org> - 2017-09-04 03:00 +0200
          Re: [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor  inspection Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-09-04 13:30 +0200
            Re: [PATCH 09/13] thermal/drivers/hisi: Remove costly sensor  inspection Leo Yan <leo.yan@linaro.org> - 2017-09-04 16:40 +0200
  [PATCH 05/13] thermal/drivers/hisi: Fix multiple alarm interrupts firing Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-08-30 11:00 +0200
    Re: [PATCH 05/13] thermal/drivers/hisi: Fix multiple alarm  interrupts firing Leo Yan <leo.yan@linaro.org> - 2017-09-01 16:50 +0200
  Re: [PATCH 01/13] thermal/drivers/hisi: Fix missing interrupt  enablement Leo Yan <leo.yan@linaro.org> - 2017-09-01 10:40 +0200

csiph-web