From patchwork Wed Oct 26 20:59:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9398329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC9B960234 for ; Wed, 26 Oct 2016 21:00:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92AFC29D82 for ; Wed, 26 Oct 2016 21:00:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 856DD29DE7; Wed, 26 Oct 2016 21:00:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFF3429D82 for ; Wed, 26 Oct 2016 21:00:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F5616E933; Wed, 26 Oct 2016 21:00:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk0-f66.google.com (mail-vk0-f66.google.com [209.85.213.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C0CF6E933 for ; Wed, 26 Oct 2016 21:00:07 +0000 (UTC) Received: by mail-vk0-f66.google.com with SMTP id q126so576819vkd.3 for ; Wed, 26 Oct 2016 14:00:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/LIruweBSMpEpNxqAbZv6mQNNJSNVh191jWFQxzCUdw=; b=GrU+n6AvxM4Q7xMp4zYPs0L3mFg/MmZM8J5GaATTwx5BrmJRRO0Epp6t7TITMH2Rjw QIUzccBo7vbG4MpyR54TYeNTJrI1aY8x7pMqPhQw7YmUtxdFAGGvA221BdJCu516bc7v 7iMAfCYZ2NHWKm9VcJABN7lMJVEKXRJOjcgRj0uf+MfKv4JLoI68WsRTztOKnx4lw+BQ U2dSI4BWfp7kpzlb+mII1JE7Qr/FhxHFIGN8zTz6jr0UybMSzcnh7RoVl0Ck4+h/uunM 6MD7XRDMp6cjMb+EId8cCu7BEvA7yloKH+CRxM2M1NuJ+vUtvic4O2qIChu4e7D3Ihrm X1/g== X-Gm-Message-State: ABUngvcFby5PPUAM4tQH15xkmkqWUJ/MTkTc4dVY3S6ALNITGYZnw2xwBaUzog/IRcdUSA== X-Received: by 10.31.237.67 with SMTP id l64mr3233517vkh.56.1477515606589; Wed, 26 Oct 2016 14:00:06 -0700 (PDT) Received: from jade.localdomain ([187.64.228.41]) by smtp.gmail.com with ESMTPSA id 39sm985519uam.19.2016.10.26.14.00.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 14:00:05 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH] dma-buf/sw_sync: put fence reference from the fence creation Date: Wed, 26 Oct 2016 18:59:59 -0200 Message-Id: <1477515599-7685-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 Cc: Gustavo Padovan X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Once sw_sync_ioctl_create_fence() returns we no longer have the *pt pointer to the fence base object thus we need to put the reference we have from the fence creation to keep a correct reference accounting. Signed-off-by: Gustavo Padovan Reviewed-by: Chris Wilson --- drivers/dma-buf/sw_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 82e0ca4..efed2b7 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c @@ -316,8 +316,8 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj, } sync_file = sync_file_create(&pt->base); + dma_fence_put(&pt->base); if (!sync_file) { - dma_fence_put(&pt->base); err = -ENOMEM; goto err; }