Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3342799pxb; Mon, 1 Nov 2021 12:05:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhZG4BV2IppZ+LZYZhdbpOrcuQw8VVDgqSGIYakEYl8dVWGfWYI9W+7ztq+S5jA5rIqv31 X-Received: by 2002:a05:6402:2808:: with SMTP id h8mr12926715ede.267.1635793533129; Mon, 01 Nov 2021 12:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635793533; cv=none; d=google.com; s=arc-20160816; b=x5K2+Af2LDSw1h4JqddElMwagjnf6v01sLCIzuIKROHiGaBbhqwge1ewhJS4aC04IE SOu4xCRCwyfCGHnCzRv/IJuYzRrx+Zw3A5JFRCDoum176SMPt7Hds2NUbQ5bkkN9meRI QQppVgOhJTTPrPddAA1+N61U7Mh4D/LLlKp9kL9vD8XrWLTPlxG8TKaACMt4oyJGGKA4 IB6u6wKZ7l5/73MkruStbSfO84KKCjZrAcBbI8DrHF+5zVpF73QQbP4DioSTH1IiOc9T gqgDYGiF5Yio9QowNiSFnYp9e9xc1uAkOoiKmoayBBo6rtjgaaqQvLC26D5xDHJOYg7E NvXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=DXqY8tqCZBao6El1pUTMduhWM+XYcdda0ZTK24DqV/U=; b=mjO2mL04cXZOhkWWDHdctkzrFHdPkW+1OsDAtJEH2hupo8Bmw0feWcqh0C7gB6DM3g Elq1EP8Y3A6I+pXdfMPI9Oz4elqaZb9rlvrlSXz/V8Caz9QQRlUvymShBx+hQKu+MRV5 JiG2N8scOQ2SKw3U5fRYR9p7DdC6MDBZjFFiR22o60Ug8GSNgIVBhxk+y7PueBybWKdo q/DXXyDVHzOPahPUEV0TFoUSAUe06eJdpiiZgBqAR5yXnwmMg+yPDLu6tDmHcPYiuEFq PodOsHEelJJLI7LcL9m+sLoAlT1hBvORcRzCMSXX/VuQfMkC8eL9Xjat3/wCeKX/6WK3 b0OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si12707118edp.30.2021.11.01.12.05.08; Mon, 01 Nov 2021 12:05:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbhKATDP (ORCPT + 99 others); Mon, 1 Nov 2021 15:03:15 -0400 Received: from mga09.intel.com ([134.134.136.24]:19587 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231732AbhKATCr (ORCPT ); Mon, 1 Nov 2021 15:02:47 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10155"; a="230950461" X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="230950461" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 12:00:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="576318517" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 01 Nov 2021 12:00:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 66594125; Mon, 1 Nov 2021 21:00:10 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Lee Jones , linux-kernel@vger.kernel.org Cc: Orlando Chamberlain , Aditya Garg Subject: [PATCH v2 1/1] mfd: intel-lpss: Fix too early PM enablement in the ACPI ->probe() Date: Mon, 1 Nov 2021 21:00:08 +0200 Message-Id: <20211101190008.86473-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The runtime PM callback may be called as soon as the runtime PM facility is enabled and activated. It means that ->suspend() may be called before we finish probing the device in the ACPI case. Hence, NULL pointer dereference: intel-lpss INT34BA:00: IRQ index 0 not found BUG: kernel NULL pointer dereference, address: 0000000000000030 ... Workqueue: pm pm_runtime_work RIP: 0010:intel_lpss_suspend+0xb/0x40 [intel_lpss] To fix this, first try to register the device and only after that enable runtime PM facility. Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices") Reported-by: Orlando Chamberlain Reported-by: Aditya Garg Signed-off-by: Andy Shevchenko Tested-by: Aditya Garg --- v2: added tag (Aditya), returned 0 explicitly at the end of ->probe() drivers/mfd/intel-lpss-acpi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index 3f1d976eb67c..f2ea6540a01e 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -136,6 +136,7 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) { struct intel_lpss_platform_info *info; const struct acpi_device_id *id; + int ret; id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev); if (!id) @@ -149,10 +150,14 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->irq = platform_get_irq(pdev, 0); + ret = intel_lpss_probe(&pdev->dev, info); + if (ret) + return ret; + pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - return intel_lpss_probe(&pdev->dev, info); + return 0; } static int intel_lpss_acpi_remove(struct platform_device *pdev) -- 2.33.0