From patchwork Tue Jul 10 23:40:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1179391 Return-Path: X-Original-To: patchwork-linux-mmc@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 A8EC0DFFFE for ; Tue, 10 Jul 2012 23:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755270Ab2GJXlG (ORCPT ); Tue, 10 Jul 2012 19:41:06 -0400 Received: from na3sys009aog121.obsmtp.com ([74.125.149.145]:43632 "EHLO na3sys009aog121.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755112Ab2GJXlC (ORCPT ); Tue, 10 Jul 2012 19:41:02 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]) (using TLSv1) by na3sys009aob121.postini.com ([74.125.148.12]) with SMTP ID DSNKT/y9jeHLJAudAhVLzKOiB8Tb7OpnF42h@postini.com; Tue, 10 Jul 2012 16:41:01 PDT Received: by pbbrr13 with SMTP id rr13so1223591pbb.26 for ; Tue, 10 Jul 2012 16:41:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=EzDL+l/6wzsuOKyKe/giEPV/9t4OIIvxirAladE27KI=; b=PSSNkbMeG81rfQvl3549eFPnjPfgiaI/lteHe3Fk9T7PqJUzOutXruWmY8kll6AYY0 /Z+kIAv/m3IUfrlKgZIPwsXcGx7L2E8HIMMLLIT5VDe3wbyUIuAJpDnJaF0RaPfc9Qf/ hOoVaHbw3W5S/zUjdwNJmgi93/OmWNkWzVQxzdxxUwiYQq8S5X7PVJKc7MnJTl3+k/u7 8jd8FDM5XJ/neAKZy/zR1wQ+4sb9106JocgdxlIsKavpKVHcPU5N4JL7DSpFIEOqL5e+ ZfyIMKre+hSa3jaDwMl5L7lQmkcdVUXyUXqFtvvRIjqcNFMwMB0btchzhnrF3Ac+0fIq pnIg== Received: by 10.66.75.74 with SMTP id a10mr77470601paw.46.1341963660800; Tue, 10 Jul 2012 16:41:00 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id oo6sm452516pbc.22.2012.07.10.16.40.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jul 2012 16:41:00 -0700 (PDT) From: Kevin Hilman To: Chris Ball , Venkatraman S , linux-mmc@vger.kernel.org Cc: linux-omap@vger.kernel.org, Balaji T K (commit_signer:14/49=29%), Rajendra Nayak (commit_signer:11/49=22%), Adrian Hunter (commit_signer:9/49=18%), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] mmc: omap_hsmmc: ensure probe returns error upon resource failure Date: Tue, 10 Jul 2012 16:40:56 -0700 Message-Id: <1341963658-20896-1-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.9.2 X-Gm-Message-State: ALoCoQkiA2FYOI08rIKXtL5AK5+frRJIZpXI44DpM5ZXEeiuwfwPMfamE1F6zYXs4qmvpVHK6ODX Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org If platform_get_resource_by_name() fails, driver probe is aborted an should return an error so the driver is not bound to the device. However, in the current error path of platform_get_resource_by_name(), probe returns zero since the return value (ret) is not properly set. With a zero return value, the driver core assumes probe was successful and will bind the driver to the device. Fix this by ensuring that probe returns an error code in this failure path. Signed-off-by: Kevin Hilman Acked-by: Venkatraman S --- drivers/mmc/host/omap_hsmmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 389a3ee..19e60e9 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1931,6 +1931,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); if (!res) { dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n"); + ret = -ENXIO; goto err_irq; } host->dma_line_tx = res->start; @@ -1938,6 +1939,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); if (!res) { dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n"); + ret = -ENXIO; goto err_irq; } host->dma_line_rx = res->start;