From patchwork Tue Oct 21 17:19:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39202 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D36F124039 for ; Tue, 21 Oct 2014 17:19:36 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id c13sf686384eek.1 for ; Tue, 21 Oct 2014 10:19:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=cBtbg6G107I4uCU+6EI70dUHF1tlbV9fIvbF/OKhcGU=; b=kLNy0cDf6R9SADFgaF9ok4LzaorVepG2N21nn3ABxn8LhmMLQRd+h8KjINEOseiSCC kUOfthSoJa2EHOtZoeEoxyj0KddGb2XXI4VqGBnSCi+D2nDg69lo4X/ynJNWqK5URsu0 fjiwOyt/TbaJAoQd467lbnXcFyAgmA0/ZTMx/HceW38r7z1X6UNoYCMquOvW+uegngME oRRoWbyBFKI8HTn6Dyj22EuHGsTy5TXoA7twvWy8b4fcKkwM2xQ5r8YGGSRDEi3ahWQK 1C/4do50jmCIOu5vvxnN30lC1hlZb2pRwrBZsIAN1lgqAASEps+hT+1IlBl/o8HTKS9j /qzA== X-Gm-Message-State: ALoCoQmiEYUtl7DWarWifdOovN7sGUo2NtiI3iPwV/R3AZlXxKo4fdllJi1SpMx9rwJ4S4Javi8B X-Received: by 10.181.27.135 with SMTP id jg7mr3789992wid.5.1413911975982; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.7 with SMTP id cq7ls86604lad.8.gmail; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) X-Received: by 10.152.23.68 with SMTP id k4mr18096690laf.79.1413911975671; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id li6si19947939lbc.87.2014.10.21.10.19.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gf13so1637673lab.15 for ; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr35586868lbb.74.1413911975591; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp545254lbz; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) X-Received: by 10.152.10.143 with SMTP id i15mr36534295lab.5.1413911975260; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id t7si19923016laa.104.2014.10.21.10.19.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gi9so1437266lab.19 for ; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr31393430lap.44.1413911975166; Tue, 21 Oct 2014 10:19:35 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id uh7sm4791085lac.1.2014.10.21.10.19.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:19:34 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 09/15] mmc: core: Don't panic when fetching EXT_CSD Date: Tue, 21 Oct 2014 19:19:07 +0200 Message-Id: <1413911953-19012-10-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413911953-19012-1-git-send-email-ulf.hansson@linaro.org> References: <1413911953-19012-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Instead of doing BUG_ON(), return an error code. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 755019d..55757fe 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -185,8 +185,8 @@ static int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) int err; u8 *ext_csd; - BUG_ON(!card); - BUG_ON(!new_ext_csd); + if (!card || !new_ext_csd) + return -EINVAL; if (!mmc_can_ext_csd(card)) return -EOPNOTSUPP; @@ -368,8 +368,6 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) int err = 0, idx; unsigned int part_size; - BUG_ON(!card); - /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */ card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE]; if (card->csd.structure == 3) {