From patchwork Wed Mar 7 15:05:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 10264253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CFA936016D for ; Wed, 7 Mar 2018 15:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDC17288D0 for ; Wed, 7 Mar 2018 15:05:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2586289B5; Wed, 7 Mar 2018 15:05:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 421EA28B8D for ; Wed, 7 Mar 2018 15:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754603AbeCGPFL (ORCPT ); Wed, 7 Mar 2018 10:05:11 -0500 Received: from mga11.intel.com ([192.55.52.93]:10595 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754582AbeCGPFJ (ORCPT ); Wed, 7 Mar 2018 10:05:09 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2018 07:05:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,436,1515484800"; d="scan'208";a="209602376" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.56]) by fmsmga006.fm.intel.com with ESMTP; 07 Mar 2018 07:05:07 -0800 From: Jarkko Nikula To: linux-spi@vger.kernel.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , Jarkko Nikula Subject: [PATCH] spi: pxa2xx: Disable runtime PM if controller registration fails Date: Wed, 7 Mar 2018 17:05:04 +0200 Message-Id: <20180307150504.16214-1-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.16.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't leave runtime PM enabled in case devm_spi_register_controller() returns with an error. Otherwise runtime PM will complain when driver is reloaded: [ 693.855811] pxa2xx-spi pxa2xx-spi.13: Unbalanced pm_runtime_enable! Signed-off-by: Jarkko Nikula --- This can be hit quite easily when breaking the rmmod/modprobe loop with CTRL+C and kthread startup in spi_init_queue() is interrupted. while :; do rmmod spi_pxa2xx_platform ; modprobe spi_pxa2xx_platform; done [ 688.501525] spi_master spi2: failed to create message pump task [ 688.508235] spi_master spi2: problem initializing queue [ 688.514328] pxa2xx-spi pxa2xx-spi.13: problem registering spi master [ 688.521529] pxa2xx-spi: probe of pxa2xx-spi.13 failed with error -4 ... [ 693.855811] pxa2xx-spi pxa2xx-spi.13: Unbalanced pm_runtime_enable! --- drivers/spi/spi-pxa2xx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 713506eff07d..82dcb88fcfba 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1806,6 +1806,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return status; out_error_clock_enabled: + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); clk_disable_unprepare(ssp->clk); pxa2xx_spi_dma_release(drv_data); free_irq(ssp->irq, drv_data);