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: 1179381 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 8EEC2DFF0F for ; Tue, 10 Jul 2012 23:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755112Ab2GJXlG (ORCPT ); Tue, 10 Jul 2012 19:41:06 -0400 Received: from na3sys009aog119.obsmtp.com ([74.125.149.246]:45807 "EHLO na3sys009aog119.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755115Ab2GJXlC (ORCPT ); Tue, 10 Jul 2012 19:41:02 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]) (using TLSv1) by na3sys009aob119.postini.com ([74.125.148.12]) with SMTP ID DSNKT/y9jeHLJAudAhVLzKOiB8Tb7OpnF42h@postini.com; Tue, 10 Jul 2012 16:41:02 PDT Received: by pbbro12 with SMTP id ro12so1124839pbb.32 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=INK+1eOFrAcJO3N2gGZFIyFJ9A+XKTVO1wJMwDTnF8yMSWRE9ekzRHG3MOd53Vj9FS ortAKh87LYH5YzsuYQX7X4vHDj915hklHfNNMfz3ZQGztbwaYXrAy3/Pk9vmSy0tIubZ ZOBzp+9JdYYjMbURbTaLRnuZCWY2IMkizqQZCuD2xOtNGWGaWcPaA9MSbyZDq+GBndcF JVHqOtAMZ2lTihkhZm2ngouTBWUnUCtp3XEbMpLtx9Afu/7XtwJddIk7q+q5dI+ONihV q5+qzEWHRvRW0OPlxahwi1khahvhM1U5aEGd2EXz7FmRwgykCKXosnDer0O4j/NQpLqs 1sWg== 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: ALoCoQmRHurTQ3EQHNWRFP1ewRTEOJ0hfre1Yc4kzyxJwR+wzOFjdgT8lhizWguHCyGQ8tVJTaJf Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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;