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: 115445 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4047408qgn; Tue, 10 Oct 2017 11:13:38 -0700 (PDT) X-Received: by 10.159.204.147 with SMTP id t19mr12847656plo.7.1507659218543; Tue, 10 Oct 2017 11:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507659218; cv=none; d=google.com; s=arc-20160816; b=cXiynlDtfYFORPpwesFPI4c7trS5Py4d3cFDfmf6h1uLHsSLhpdqYCPpTwtaXOgmOQ Vyro2q7y9BsmQ9SfR0v++K5MhdcEJArNAgcB++hkUh/8tsEXtsKxqYCcs3yYtsvh1aHK YAc7RbUqO6x/5mkzMcsrfZkZL1mRkH/ECy7SmMiEP18n+/HxaY4IU3HEodIXm5RHwSu2 tKycizbadyqnokWQgqpy/+xsPKfwVYQvbcWFRgFrQ9I4IDsUDy5TWVeRU8DIO+t4Pv+S ANTpOV6ST4NsYgytseUHYmQctPWjgtzHZ4YuReBW/GxJTaJdoAoEg7zHsDICUBU15fSn 2prw== 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=glFV4/igu+T2FbtUZono3qTHux0LHp9YdbivhdPmwXC0ji0I7YFKkV1F6qAx0MTv/y wiOcf0GqtQqgWTLoayCTnVMEkiL3oPovnMoqlrmyPpEORwBS3tAVN3Nn+QkrRX4cML/W gfpo6qhGuV8d2uwxSm/9ite9jNiBHuYvDyDRZRptxjiXqxZt5w8lJcOLDO+RorOLA6CV F5a1hv3PSlyUjpKF+ytG8nXBwSKFvHth3mQu60Y4WpdMCzbejwY3k5Jmi6EE2wumZbp4 svMh2A9cH45zPm2Iqmgrf9SXeKllaolodWQXa/rl3ZO9uwJ5EIgfneqL43ORPGlif3xJ PXkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RGSJ2dLE; 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 b3si5164584plr.706.2017.10.10.11.13.38; Tue, 10 Oct 2017 11:13:38 -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=RGSJ2dLE; 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 S932391AbdJJSE6 (ORCPT + 26 others); Tue, 10 Oct 2017 14:04:58 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:53957 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756308AbdJJSEw (ORCPT ); Tue, 10 Oct 2017 14:04:52 -0400 Received: by mail-wm0-f51.google.com with SMTP id q132so7694866wmd.2 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=iut9NeYu043lLJnB+Ebc5Q1Ff4ctrG7Lw0hSEQ9tkdtQq1sdGkwLD4iPMLft1N+M88 gAwwKsEfgJBKNWL9V0FyasAnLIEqRFQHkViKgTX6hqLEr3xVgICcFRfMifvH9HMVO4bG srp3QoiC4RtX6lND+ohWggHoJGXhLH44FsInb/r2U0PAPvMnUrpq6C9mo8a48FSAZW3l FuG8XnFyZLTHTCojSddwM+VSmsnFuqpuK158IxyKYPoOL4Uat39NIZlWcSPIqQJQTV1H eNFNcxd9X9q5nuVzj8+EUv/PUfgKal6UDy3gZvv/r+cKOEwcHuG3Wk07KPiKfqn5xUN4 QWfA== X-Gm-Message-State: AMCzsaUDbjxNyIwDibI8MeBFcjS/W8Obfc5hqtwTqkbZ8hGVELmfGccg 5zU33E4nY618ykzaK7bWFlY+ig== 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-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;