From patchwork Sun Nov 14 10:40:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 323182 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAEAeFPD013946 for ; Sun, 14 Nov 2010 10:40:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755097Ab0KNKkO (ORCPT ); Sun, 14 Nov 2010 05:40:14 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:37691 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755030Ab0KNKkN (ORCPT ); Sun, 14 Nov 2010 05:40:13 -0500 Received: by wwb29 with SMTP id 29so362707wwb.1 for ; Sun, 14 Nov 2010 02:40:12 -0800 (PST) Received: by 10.216.35.77 with SMTP id t55mr4098984wea.67.1289731211708; Sun, 14 Nov 2010 02:40:11 -0800 (PST) Received: from localhost.localdomain (109-186-75-6.bb.netvision.net.il [109.186.75.6]) by mx.google.com with ESMTPS id x3sm3112986wes.46.2010.11.14.02.40.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Nov 2010 02:40:11 -0800 (PST) From: Ohad Ben-Cohen To: Cc: Chris Ball , Daniel Drake , Ohad Ben-Cohen Subject: [PATCH] sdio: fix nasty oops in mmc_sdio_detect Date: Sun, 14 Nov 2010 12:40:33 +0200 Message-Id: <1289731233-19996-1-git-send-email-ohad@wizery.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 14 Nov 2010 10:40:16 +0000 (UTC) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index c3ad105..42a949b 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -560,6 +560,19 @@ static void mmc_sdio_detect(struct mmc_host *host) mmc_release_host(host); + /* + * Tell PM core it's OK to power off the card now. + * + * The _sync variant is used in order to ensure that the card + * is left powered off in case an error occurred, and the card + * is going to be removed. + * + * Since there is no specific reason to believe a new user + * is about to show up at this point, the _sync variant is + * desirable anyway. + */ + pm_runtime_put_sync(&host->card->dev); + out: if (err) { mmc_sdio_remove(host); @@ -568,9 +581,6 @@ out: mmc_detach_bus(host); mmc_release_host(host); } - - /* Tell PM core that we're done */ - pm_runtime_put(&host->card->dev); } /*