From patchwork Thu Oct 19 17:05:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 116415 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp721657qgn; Thu, 19 Oct 2017 10:08:41 -0700 (PDT) X-Received: by 10.99.189.18 with SMTP id a18mr1908174pgf.168.1508432920924; Thu, 19 Oct 2017 10:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508432920; cv=none; d=google.com; s=arc-20160816; b=GNd+NZOakdP5QUk4FJyA8a06aorTT9FOwmxRmphf87A/Xp4nli6ZDpaifuuM2qlvrn OaYDNPltnEpysH7FfmLOKcpC/fQqGF3nlr/VM4RyarmjlNX7HqOscW9Wz10f9QVOK3/h ucuhan0TDFMKZaKxucelJtCWkEgacO/4Aluc2eZSRrcfJUBE1GN+pWR+waeGOJ7N4UqT Sq0fRXSTnFwbu4qPUm9mxZ3GNoBXCQ+p3k+159UsbqkFCZshmJTwfHRRdF6kR/9GdJlO gTJXP1bwnmJMqg962bnmhrQKLOkW/BMNrlbBR7QQ0vOLft9zPealsC3eSgj5UhF5/Zz9 FfbQ== 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=b1XO1Q6oDJ+0Zqsb1mpoVsrFtWrFMVdCtEDLzYWAduw=; b=HQGEWllq8/GRNlExgO2gM8Aubq5zuzmw2f55iGmx2e1BdrAehR1UP8hxpVUawf2+WR LysET8MF1kOZtrFsTjp6jBpdmQGGfr4UUSsrS9N2gUkpaivpFz+9c8Bs8fb7/Ifznk+W AckzzdZYkqwupaVGih0gl/GcJMZD7LB2BT/FB8XevsgxPccY9J51Eqr2CxJ5crQvkOfM 04oZ+sQPL+SQ0kv1hnn+vcdgjYCRUxRwon+AK9NGPne5L0rI4WxPeCGGBAp38GccXiP8 n4UvAJBTftESyypQV1MA7CpT8BLStW6DGV1RQMkFEkXsMx4S+HtLLJhW8u+E3ZfiIcLV /bgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NfTva1ov; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 a24si8812310pfg.299.2017.10.19.10.08.40; Thu, 19 Oct 2017 10:08:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=NfTva1ov; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1755035AbdJSRIi (ORCPT + 27 others); Thu, 19 Oct 2017 13:08:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54526 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755012AbdJSRIe (ORCPT ); Thu, 19 Oct 2017 13:08:34 -0400 Received: by mail-wm0-f65.google.com with SMTP id i124so17714537wmf.3 for ; Thu, 19 Oct 2017 10:08:33 -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=NfTva1ov5vV73p4Gco+pnyW2XhwHN5uWqlrEAjBOtaVjtGHgps0KSvP9LfyKaNCZWX IQUmw8LwpzIFfR7vdWYRbEe9R6OeSXo/6fbrp+GqEM9jVke+OeCwwDw+t2p9UbWsKx9q LKe7tV9U1coEloDb2o1E0Yrgw4JbYFzph/vgA= 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=TZX7/CbJUqpBX27nc8u6U0pUhVcJp9UxRx8wdk4gHEFwLbV6+rojN/TYmWjkMbDayU DhgFGsQytQmszn3LrtlkGaSpn/uKJVmJRLlzIgqKFW/qvckDEDCBRYpaBnEHTqzJGswR upueKL+8SaDGjHDUBa1LaXfRx4vwKiLt4+AI8Fm8QuID0VsaB6baab6tCMnBzC5/cpke XZN7OYEM03pOOCBXj9ZuBcU0XSQLxxpeMmVeyHzoj5QiF5SwpfZ2N/FJTNcy2n7XY0M8 iYp6kXa31BzdGUCXnbFdJRfkK9iTFsNGKrGabZ3lkiYYLyrXWwIWp2aaQtbouT/XXsgF 2YrQ== X-Gm-Message-State: AMCzsaV+0H8YUzgzLlJtxGfd/9vZ3QB4cyi8SXk2UHHnk8K9+/rEE0u0 NULfXCCrDRf4e+q+x3r/U3Gkbw== X-Google-Smtp-Source: ABhQp+QRcTQ+99md1v4YlbzHK/FE+akPfqqbmjlYZIPjULUqOtpKolT9dgij20jRFlBOUqkkdajL8w== X-Received: by 10.28.184.141 with SMTP id i135mr2414871wmf.143.1508432912971; Thu, 19 Oct 2017 10:08:32 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:51c7:d9b7:e14b:6840]) by smtp.gmail.com with ESMTPSA id g16sm14277394wrd.72.2017.10.19.10.08.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Oct 2017 10:08:32 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/18] thermal/drivers/hisi: Fix kernel panic on alarm interrupt Date: Thu, 19 Oct 2017 19:05:45 +0200 Message-Id: <1508432760-17847-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508432760-17847-1-git-send-email-daniel.lezcano@linaro.org> References: <6ac48f08-7fe6-92e9-0801-6ed3bcd05ff1@linaro.org> <1508432760-17847-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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;