From patchwork Tue Oct 21 17:19:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39207 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC2682039B for ; Tue, 21 Oct 2014 17:19:43 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf1109988wgh.8 for ; Tue, 21 Oct 2014 10:19:43 -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=pN2YLkBfLAT0GMHETIKfzgjyjZzZm9cXFJVl+HKkzY0=; b=KPLKf1GYAcIFGYzUgcG1/rNqm2ml4G+SnBCdW/syEMvbej04z9SE24GIis1S9/LSbx sPxhhnbV6paO5JdrEK6OPrapQha3AVKNgDvd6cfjeXeq4QnB4CHr+WB59BPe4F0XEaS8 O8OvKVG5LXtCswl5V+HIA3x5zUIJLNbcIEL998GXSesZKShzwIxNobsSvzrbPFXgEWQg ZvG7RmLt7NOmp3ar3AGvnCZYYiiEFvtjbUWQ8LU/yJkD815bxT0BftJtgJ8pf3raM5ey ssKDWnE7Xov3bD2AvpnYL6pxUVJTtnFnwJf391oyQf6VC/okRh1S2Q4kyK8+Hc247Niu dDGg== X-Gm-Message-State: ALoCoQkTHg6hZJb3mZGUYkJ9DmphAQrmwuszZuGTOSdwIVijFF4InTGSLIW42diKtma9PkVJ1/D9 X-Received: by 10.181.11.130 with SMTP id ei2mr3790363wid.3.1413911982674; Tue, 21 Oct 2014 10:19:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.225 with SMTP id n1ls83324lan.34.gmail; Tue, 21 Oct 2014 10:19:42 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr36294166lad.29.1413911982331; Tue, 21 Oct 2014 10:19:42 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id 1si19984863lai.41.2014.10.21.10.19.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id n15so1397519lbi.39 for ; Tue, 21 Oct 2014 10:19:42 -0700 (PDT) X-Received: by 10.152.120.199 with SMTP id le7mr2384361lab.67.1413911982260; Tue, 21 Oct 2014 10:19:42 -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 c5csp545281lbz; Tue, 21 Oct 2014 10:19:41 -0700 (PDT) X-Received: by 10.112.135.197 with SMTP id pu5mr36260699lbb.22.1413911980842; Tue, 21 Oct 2014 10:19:40 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id jl10si19935665lbc.96.2014.10.21.10.19.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gm9so1492235lab.27 for ; Tue, 21 Oct 2014 10:19:40 -0700 (PDT) X-Received: by 10.112.41.168 with SMTP id g8mr35646524lbl.59.1413911980738; Tue, 21 Oct 2014 10:19:40 -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.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:19:39 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 12/15] mmc: core: Use mmc_get_ext_csd() instead of mmc_send_ext_csd() Date: Tue, 21 Oct 2014 19:19:10 +0200 Message-Id: <1413911953-19012-13-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.217.180 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: , By using mmc_get_ext_csd() in favor of mmc_send_ext_csd, we decrease code duplication. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 17 +++-------------- drivers/mmc/core/debugfs.c | 9 +-------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f26a5f1..4b9fe01 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -709,27 +709,16 @@ int mmc_read_bkops_status(struct mmc_card *card) int err; u8 *ext_csd; - /* - * In future work, we should consider storing the entire ext_csd. - */ - ext_csd = kmalloc(512, GFP_KERNEL); - if (!ext_csd) { - pr_err("%s: could not allocate buffer to receive the ext_csd.\n", - mmc_hostname(card->host)); - return -ENOMEM; - } - mmc_claim_host(card->host); - err = mmc_send_ext_csd(card, ext_csd); + err = mmc_get_ext_csd(card, &ext_csd); mmc_release_host(card->host); if (err) - goto out; + return err; card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; -out: kfree(ext_csd); - return err; + return 0; } EXPORT_SYMBOL(mmc_read_bkops_status); diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 91eb162..e914210 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -291,14 +291,8 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) if (!buf) return -ENOMEM; - ext_csd = kmalloc(512, GFP_KERNEL); - if (!ext_csd) { - err = -ENOMEM; - goto out_free; - } - mmc_get_card(card); - err = mmc_send_ext_csd(card, ext_csd); + err = mmc_get_ext_csd(card, &ext_csd); mmc_put_card(card); if (err) goto out_free; @@ -314,7 +308,6 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) out_free: kfree(buf); - kfree(ext_csd); return err; }