From patchwork Thu Mar 8 14:52:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10268223 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 1689A6037E for ; Thu, 8 Mar 2018 14:55:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0573929A08 for ; Thu, 8 Mar 2018 14:55:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1FA3299D4; Thu, 8 Mar 2018 14:55:12 +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 2B8DD29B37 for ; Thu, 8 Mar 2018 14:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934017AbeCHOxT (ORCPT ); Thu, 8 Mar 2018 09:53:19 -0500 Received: from mail.bootlin.com ([62.4.15.54]:51453 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934297AbeCHOxQ (ORCPT ); Thu, 8 Mar 2018 09:53:16 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id D1E82207A5; Thu, 8 Mar 2018 15:53:13 +0100 (CET) Received: from localhost (unknown [185.94.189.190]) by mail.bootlin.com (Postfix) with ESMTPSA id 42A50207ED; Thu, 8 Mar 2018 15:53:13 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , ulf.hansson@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Quentin Schulz , Thomas Petazzoni Subject: [PATCH v2 7/8] mmc: sunxi: Set our device drvdata earlier Date: Thu, 8 Mar 2018 15:52:53 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As soon as the pm_runtime_enable hook is called, our runtime_suspend and runtime_resume hooks can be called as well. However, we only set the device drvdata that we will use after we have registered into the MMC core. Move that earlier so that we don't have a race that could lead to a crash. Signed-off-by: Maxime Ripard --- drivers/mmc/host/sunxi-mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index c6431f6e816f..f6374066081b 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1336,6 +1336,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "mmc alloc host failed\n"); return -ENOMEM; } + platform_set_drvdata(pdev, mmc); host = mmc_priv(mmc); host->dev = &pdev->dev; @@ -1402,7 +1403,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev) goto error_free_dma; dev_info(&pdev->dev, "base:0x%p irq:%u\n", host->reg_base, host->irq); - platform_set_drvdata(pdev, mmc); return 0; error_free_dma: