From patchwork Fri Dec 13 22:23:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22388 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35EAD23FBA for ; Fri, 13 Dec 2013 22:26:43 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf8734305obb.6 for ; Fri, 13 Dec 2013 14:26:42 -0800 (PST) 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:cc: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=6gpS3TWtAmZGcyI00L0oDUadRGwfcHAglnDmVBdzZvc=; b=As/Su7zhgSIFgabjLPhACN48vj10s9gs9xPLXFIjdUCdSaQEfacbl3ldm99AdG5U9r SqCMrBQLaSn0gnL559nxGUE2f2wiklX7qSw1NuuUxBZzmj9BKmS3A6/qJqi5hSORzj4W saINjojfSg0RoxUuNyUH0uwNLS2oYL4PcgPko9xTGi+LZ5Ue2LQb6CX5SumLY1EFN+qJ NACNNkaUI5y1UzWqPhlxfj75fIS7cUQK8K308USSxpI6YjmB4ag5g7CsNqfyoRnMP959 p3lebXPhnYwBOxtqw7g5ijfEhAw8x6MPXzqjZ3jAyoBSziKJlnqntUkmpUWEQ6MtHxcC lumA== X-Gm-Message-State: ALoCoQkOyVMoSp4jgkjocS+0kR/i0PvMA4p63d+3+xJh25JL/ALJZROmWOahqvVW8weVBes6rMp3 X-Received: by 10.182.19.231 with SMTP id i7mr1887936obe.25.1386973602764; Fri, 13 Dec 2013 14:26:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.169 with SMTP id i9ls1241884qer.65.gmail; Fri, 13 Dec 2013 14:26:42 -0800 (PST) X-Received: by 10.58.6.239 with SMTP id e15mr2171550vea.29.1386973602497; Fri, 13 Dec 2013 14:26:42 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id tl2si1188129vdc.116.2013.12.13.14.26.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so1813023veb.22 for ; Fri, 13 Dec 2013 14:26:42 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr2255916vcb.14.1386973602327; Fri, 13 Dec 2013 14:26:42 -0800 (PST) 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.220.174.196 with SMTP id u4csp73484vcz; Fri, 13 Dec 2013 14:26:42 -0800 (PST) X-Received: by 10.68.29.72 with SMTP id i8mr6176726pbh.116.1386973601599; Fri, 13 Dec 2013 14:26:41 -0800 (PST) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id ya10si2508161pab.124.2013.12.13.14.26.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:41 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.42; Received: by mail-pb0-f42.google.com with SMTP id uo5so3187396pbc.1 for ; Fri, 13 Dec 2013 14:26:41 -0800 (PST) X-Received: by 10.68.172.196 with SMTP id be4mr6179232pbc.12.1386973601211; Fri, 13 Dec 2013 14:26:41 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.26.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:40 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Laura Abbott , John Stultz Subject: [PATCH 023/115] gpu: ion: Don't call ion_buffer_put on error path Date: Fri, 13 Dec 2013 14:23:57 -0800 Message-Id: <1386973529-4884-24-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , From: Laura Abbott If dma_buf_fd fails, the dma_buf needs to be cleaned up by calling dma_buf_put. dma_buf_put will call ion_dma_buf_release which in turn calls ion_buffer_put to clean up the buffer reference. Calling ion_buffer_put after dma_buf_put drops the reference count by one more which is incorrect. Fix this by getting rid of the extra ion_buffer_put call. Signed-off-by: Laura Abbott [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz --- drivers/staging/android/ion/ion.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index a054edd..4d91d20 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -925,10 +925,9 @@ int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle) return PTR_ERR(dmabuf); } fd = dma_buf_fd(dmabuf, O_CLOEXEC); - if (fd < 0) { + if (fd < 0) dma_buf_put(dmabuf); - ion_buffer_put(buffer); - } + return fd; } EXPORT_SYMBOL(ion_share_dma_buf);