Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1559674pxb; Mon, 12 Apr 2021 00:35:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUxCVdhvmR8DJ+uHo73Z1DaLDwcKA6pY3YDVEMmqsJD7lJC607nECVHI9bjql1FgO/FMjq X-Received: by 2002:a17:90a:5211:: with SMTP id v17mr27972527pjh.53.1618212919379; Mon, 12 Apr 2021 00:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618212919; cv=none; d=google.com; s=arc-20160816; b=TLEccaEknAO+WHwJVm8Nxw6bCxp9kHnfGjFTOCZKaSbr7lNr2r5ygvVYOYW+f60Opu FZ3Z0WYC4gifrFFXU9H4ms0HN/bKQdBPuqE0m/1qvxnPntsBsRUWtlT5srHwT+3p/DrT +lwbXYzabZ9kmeuY4w9AwWxKdyPXvlWD4lcexs4flUPwvPhxcD+4/fyv8hS6DFTVP5OZ R2siQ5oqDUHu6RQnwJhUKAOU2rjzA4QDTnVLlDBSXncqMtdOVJn7CAxmDqPpoFYUYKmw EDSoE+OneiJnSIUDkofgwwtFLkdVIaPyLAjvWf5dLI+1JP2FcG+hI9C7MIdQ6noQ1kkr L30g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=mEdHrmfcHNmQeF6ZeyE6mAD9KNHxTqfZYNfmFy6Scmw=; b=UvPThmJiuncbYNyYwFGoVOAJmlJ/G7ioh0B09SW34cgEwm9SA4qqjbKDRdyc4lr7kA 71Zbn2wnOQY2Be9MZSkj3KelYQ3bmvKMsFNA6J+IcfGzlA+j7P01uT4DFjRuqvBwyJRr UzyxG1bEBiD0roDpKVWccGyLLKCYzozlZJk9SuUXsxLolTyLhwdw6e+HjdD1+py0zsUj sw6dn62VHrx+QPt/aPOCafD3XI73s65TX50X0jNuTA77/+9dgWoxRfNd/NYhOFAWtCnv X7YSil3+yQX5ybiCtjCLUXHPohBLYaaK09Yj6ZobgWVj7wwHy9Oe0RTAmng+i4KRHOuz 8wvg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 95si13293758pla.43.2021.04.12.00.35.07; Mon, 12 Apr 2021 00:35:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236843AbhDLHeB (ORCPT + 99 others); Mon, 12 Apr 2021 03:34:01 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:6606 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236898AbhDLHd7 (ORCPT ); Mon, 12 Apr 2021 03:33:59 -0400 Received: from localhost.localdomain (unknown [10.192.139.175]) by mail-app3 (Coremail) with SMTP id cC_KCgD34Dxq93Ng3rYJAQ--.16326S4; Mon, 12 Apr 2021 15:32:00 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Mark Brown , Michal Simek , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe Date: Mon, 12 Apr 2021 15:31:54 +0800 Message-Id: <20210412073154.25011-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgD34Dxq93Ng3rYJAQ--.16326S4 X-Coremail-Antispam: 1UD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WazAAIsb Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a PM usage counter decrement after zynqmp_qspi_init_hw() without any refcount increment, which leads to refcount leak.Add a refcount increment to balance the refcount. Also set auto_runtime_pm to resume suspended spi controller. Signed-off-by: Dinghao Liu --- changelog: v2: - Add a refcount increment to fix refcout leak instead of the refcount decrement on error. Set ctlr->auto_runtime_pm = true. --- drivers/spi/spi-zynqmp-gqspi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index c8fa6ee18ae7..8b21c7b0e7eb 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -1160,6 +1160,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); /* QSPI controller initializations */ zynqmp_qspi_init_hw(xqspi); @@ -1187,6 +1188,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_DUAL | SPI_TX_QUAD; ctlr->dev.of_node = np; + ctlr->auto_runtime_pm = true; ret = devm_spi_register_controller(&pdev->dev, ctlr); if (ret) { -- 2.17.1