From patchwork Mon Jul 30 00:12:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 1253031 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8743FDFE76 for ; Mon, 30 Jul 2012 00:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753770Ab2G3ANH (ORCPT ); Sun, 29 Jul 2012 20:13:07 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42130 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753699Ab2G3ANF (ORCPT ); Sun, 29 Jul 2012 20:13:05 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 85F9B98E46; Mon, 30 Jul 2012 02:13:00 +0200 (CEST) Date: Mon, 30 Jul 2012 10:12:45 +1000 From: NeilBrown To: Chris Ball , Venkatraman S , Balaji T K , Rajendra Nayak Cc: linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MMC/omap_hsmmc: handle failure of regulator_get better. Message-ID: <20120730101245.7dbe72b0@notabene.brown> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.7; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 1/ if regulator_get fails, return an error. This is important if it failed with EPROBE_DEFER, as the probe needs to be deferred. 2/ Don't set .set_power until the regulator has been found, or the deferred probe will not bother calling omap_hsmmc_reg_get(). Signed-off-by: NeilBrown Acked-by: Rajendra Nayak diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 389a3ee..f052c29 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -299,12 +299,12 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) struct regulator *reg; int ocr_value = 0; - mmc_slot(host).set_power = omap_hsmmc_set_power; - reg = regulator_get(host->dev, "vmmc"); if (IS_ERR(reg)) { dev_dbg(host->dev, "vmmc regulator missing\n"); + return PTR_ERR(reg); } else { + mmc_slot(host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value = mmc_regulator_get_ocrmask(reg); if (!mmc_slot(host).ocr_mask) {