From patchwork Tue Oct 21 17:19:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39209 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DEBCB2039B for ; Tue, 21 Oct 2014 17:19:49 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y10sf1114687wgg.2 for ; Tue, 21 Oct 2014 10:19:49 -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=F1Eh+zWm55UCf7HpQzhPiAL3wIsY+WA3dOFS61ael5Q=; b=j5+yiH1/3lwZdm1HXvTDf3CTM7rNgV5SegGcKnCSib9bYcnu2IUjtrurIkPZccj3VM yxB8qq49zYfggMpPBlZSq7QUNWF7Wd9VdFqXLO0R4RJQhR2kp2WkmBrUNVsQMmHn2nZM 3lNztfDt8x0e4+jCylwuwNjQzd4Zk1Mt09ExoEwbcwBh+lnASf5jGJCDvFoOFNg5+i1V mkLTMKwFHkYjqwLKmOBLqqWRSMvqBAd6uJoyp15L0TGxo4iAX66b8/u+5VH6xykTPyqa 5rNd6pf7Eptg4L7INFc4fHts4+EfY9TeCumCDIQvENoKK2bkN/JTbYIcV2cxfYjchK+K tGmA== X-Gm-Message-State: ALoCoQn7eX8lSRwP1uLq1IOOLGoCHlzY89Di5luHyZYUK8SoSPI8jTvmcnqpaWA+mUru8wv35BqY X-Received: by 10.180.93.35 with SMTP id cr3mr3796077wib.2.1413911989067; Tue, 21 Oct 2014 10:19:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.198.201 with SMTP id je9ls87293lac.92.gmail; Tue, 21 Oct 2014 10:19:48 -0700 (PDT) X-Received: by 10.112.51.77 with SMTP id i13mr36251427lbo.12.1413911988703; Tue, 21 Oct 2014 10:19:48 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id la5si19928371lac.99.2014.10.21.10.19.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so1416480lbv.5 for ; Tue, 21 Oct 2014 10:19:48 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr36320673lah.56.1413911988590; Tue, 21 Oct 2014 10:19:48 -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 c5csp545306lbz; Tue, 21 Oct 2014 10:19:48 -0700 (PDT) X-Received: by 10.112.87.162 with SMTP id az2mr32688096lbb.15.1413911987139; Tue, 21 Oct 2014 10:19:47 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id s7si19992033lbb.38.2014.10.21.10.19.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id 10so1394837lbg.32 for ; Tue, 21 Oct 2014 10:19:46 -0700 (PDT) X-Received: by 10.152.43.229 with SMTP id z5mr12324225lal.86.1413911984599; Tue, 21 Oct 2014 10:19:44 -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.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:19:43 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Subject: [PATCH 14/15] mmc: core: Don't handle buffers on stack while fetching CXD registers Date: Tue, 21 Oct 2014 19:19:12 +0200 Message-Id: <1413911953-19012-15-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.174 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: , Due to previous patches, all callers of mmc_send_cxd_data() now allocates their buffers from the heap. This enables us to simplify mmc_send_cxd_data() by removing the support of handling buffers, which are allocated from the stack. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 9a6181b..e04008f 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -264,20 +264,6 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, struct mmc_command cmd = {0}; struct mmc_data data = {0}; struct scatterlist sg; - void *data_buf; - int is_on_stack; - - is_on_stack = object_is_on_stack(buf); - if (is_on_stack) { - /* - * dma onto stack is unsafe/nonportable, but callers to this - * routine normally provide temporary on-stack buffers ... - */ - data_buf = kmalloc(len, GFP_KERNEL); - if (!data_buf) - return -ENOMEM; - } else - data_buf = buf; mrq.cmd = &cmd; mrq.data = &data; @@ -298,7 +284,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, data.sg = &sg; data.sg_len = 1; - sg_init_one(&sg, data_buf, len); + sg_init_one(&sg, buf, len); if (opcode == MMC_SEND_CSD || opcode == MMC_SEND_CID) { /* @@ -312,11 +298,6 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, mmc_wait_for_req(host, &mrq); - if (is_on_stack) { - memcpy(buf, data_buf, len); - kfree(data_buf); - } - if (cmd.error) return cmd.error; if (data.error)