From patchwork Wed Aug 30 08:47:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 111292 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp597781qge; Wed, 30 Aug 2017 01:51:32 -0700 (PDT) X-Received: by 10.99.186.73 with SMTP id l9mr836411pgu.178.1504083092771; Wed, 30 Aug 2017 01:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504083092; cv=none; d=google.com; s=arc-20160816; b=xwEQsAPyCi041LwSKXnKJyKDOiDFMfsgoYcY1M/vbJvKb0fHQJ/k8RPzjrFMzM3yzk cP28id9+0Vqs3NuvgehChvLcEBmIdvNC/AVUumn8N9ERxjv5yyjyRyexj1HlEXE163dh NawhuyLSTV5ZtWk5VRlHcLTOLrdmf085fv2djZSDve0arPWuxLKtbEjvsZ0jhYA0+xVL EMGENnsOyueILUeJyf4g+8oWrJ8iMZ98yXbP2l5engGIoir4TGtBKgOENm/f943ov4cr i7wH2AP7CeHnYRXdeWlq0JiZ6Q46/Vxp2C4Jn9Mhg7vYkbRSAY18X7V0qzG7gFmdlxPY 8xig== 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=uVfbmmx54HOtZ3QnvMk62tFTHAWiTh+5LBOf9rt7w8E=; b=RyXbQfTZ9alkbiZIGI5zFmH8WUa9Srz2FQoe5z+6mdWRUTMLBRrtbAFL/doHjzXUCv /D5Nas1GnELMHodpYMwxf343j+D9ys9oAzfTLa6x95BQp3ojqyrbhG7SN6FvHDXA5huD k5oW+j+9Rxu8S9raUw1nTCU86glK8iYqAZZN5dH6Uc8+7mMcU4hIfBVnC071Ai3mPQDS 3eAUq6pRgF1ipmjt4fU2SnrXFS4bBi0w232LovFe4Qs7oc+348wFAQlL60TPK4BVlwQ4 ttTLA9b+TBcxp52NTwnfaR1Q2yjWsd9zNxWBWYuNFNUoMhZ0j8bmNYccc6LPU3zPzy0V cLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ATqmiBrY; 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 b6si3903244pgn.316.2017.08.30.01.51.32; Wed, 30 Aug 2017 01:51:32 -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=ATqmiBrY; 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 S1751675AbdH3Iva (ORCPT + 26 others); Wed, 30 Aug 2017 04:51:30 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38059 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbdH3Iss (ORCPT ); Wed, 30 Aug 2017 04:48:48 -0400 Received: by mail-wm0-f47.google.com with SMTP id t201so6047392wmt.1 for ; Wed, 30 Aug 2017 01:48:48 -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=uVfbmmx54HOtZ3QnvMk62tFTHAWiTh+5LBOf9rt7w8E=; b=ATqmiBrYZZFTG2VZVl9nqQ+zWkHg3rKebEa2hvtPmxdsJaFZl4lvKMq0gMc3zaM3WV w4OmVossNfKleoMOqWPrpYrxHsm9nEKKjB+tvanhI1LiZBv/3VU9nNIQTePTVNeI23oF LJ6wCi90Qj8SheFtu4gr0ZXQD04LT3dQf75TM= 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=uVfbmmx54HOtZ3QnvMk62tFTHAWiTh+5LBOf9rt7w8E=; b=Ev67YzZI57otPpVzEi80Xn4T9irxby2O9Z447pT57w+W0WRkMXExMpYCeNKKCPBt6c WNSuGQ3EL0hKB9ftaRBcralmrUyRf/xo/6qwQF0MC+iXZBpZgCFjBeZRk+4tox27KrWJ sIHui4xK0zkdaR2aCikjcy/Ok+EoJ8sQCAPDGP1p1WEmYFlTOFJbq410VNDAehFquS88 TwKBwYLX7tMj+FcTV9vqYiezXkRuhE+6hZ97P8Hpcv+k91y8NaKtZh/ebWQwKbSXAMat PecLpJcc8kS/qumza4MP+gyn7+n5T70tXNhY4qHwHpFBYTk0tJMtkdWCQTnkfx7ZTL8k BIBw== X-Gm-Message-State: AHYfb5hZ3l5roMilQT5fQVyZ8XETFIas9VTRbBND5VXD7Hz2cb+aejsv 3hODN5rWHM+poe16 X-Received: by 10.28.56.2 with SMTP id f2mr729422wma.157.1504082927275; Wed, 30 Aug 2017 01:48:47 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:b0b0:ba2b:b9fd:8a33]) by smtp.gmail.com with ESMTPSA id q24sm4032811wrc.26.2017.08.30.01.48.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Aug 2017 01:48:46 -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 (open list) Subject: [PATCH 03/13] thermal/drivers/hisi: Fix kernel panic on alarm interrupt Date: Wed, 30 Aug 2017 10:47:27 +0200 Message-Id: <1504082857-21702-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504082857-21702-1-git-send-email-daniel.lezcano@linaro.org> References: <1504082857-21702-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 --- drivers/thermal/hisi_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.7.4 Reviewed-by: Leo Yan Tested-by: Leo Yan 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;