From patchwork Tue Feb 14 10:37:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicolai_H=C3=A4hnle?= X-Patchwork-Id: 9571675 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 995A860586 for ; Tue, 14 Feb 2017 10:38:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4F3127D45 for ; Tue, 14 Feb 2017 10:38:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99D9328391; Tue, 14 Feb 2017 10:38:06 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 5EBAD27D45 for ; Tue, 14 Feb 2017 10:38:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 543726E664; Tue, 14 Feb 2017 10:38:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3632F6E0E5; Tue, 14 Feb 2017 10:38:01 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id o16so27098612wra.2; Tue, 14 Feb 2017 02:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/poXJzRa59glXBLfPCfmW++nJHD7wTc0vWc++L43uwM=; b=SGUmQC/1fkOK8adnErcxuW1s5xpnmh5YxFQqhaKUVE+VuDZSPfZ4qYl5SyYNMFcSh3 ht/PZx3SXiJWW5idnfmKirLClLdeKmYIKQK6kMYMATg1KnTc+q1kS1ZHc7i6KkBI6YmV KhWKR7njTL7MljQAST77e3S8/cDq25gdC5pMAc/asUxOkej/K/GPQIkSW8bzRQcogFjZ ejMFPAOWV0SaW9V0P+c8pMFBblCua/+axFWSrKhQRmB0ckML9CBdAg+5NS+P6dIWfKBE l62i5t32QZWWby+gM+cwY5SIIV3Jq+R2USNOiCpsLNUOBeM79TCf2ZFzEDjr7WgyyUQz C+Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/poXJzRa59glXBLfPCfmW++nJHD7wTc0vWc++L43uwM=; b=MiVl1UObbNxl34JuVClAMYsF89uMf5shQ6ld/eSDxPMm63kw/FEPubVD1PZKy7az4N 2fVxIrrhsuCPrhRcmcP4q8fzNNVI1rUmQL50Yl32Ynf6on7WTPYR/eaSd6UQhnEgOpRL 1XjNQvf6iJxGdHJCMePURFTCM7QmkMFr7dZ4sGS6twzdaBlaULSM51aePgiiD1UuBFNx ECIuCm0JDn4TebtVSah6ElpOoNRCCV//qPjbgZOidencLNMweAzx5+EpAycLNi6DwHXg Rm3woqOcjF1bIdpzit81ivMYilX5W6PERL7UdweUDgexepvrTWIFdRDKGAjohYnPODDZ +iIA== X-Gm-Message-State: AMke39k8fYlraA4zBE2dhUBd0uYJzvRVPujnRzOtJKFGW5zTvENnWYWA4L6C/3pCkZ2CGg== X-Received: by 10.223.170.137 with SMTP id h9mr23246321wrc.202.1487068679648; Tue, 14 Feb 2017 02:37:59 -0800 (PST) Received: from capella.localdomain (x5ce2e06e.dyn.telefonica.de. [92.226.224.110]) by smtp.gmail.com with ESMTPSA id a13sm2929241wma.13.2017.02.14.02.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 02:37:59 -0800 (PST) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: amd-gfx@lists.freedesktop.org Subject: [PATCH 2/3] drm/ttm: fix the documentation of ttm_bo_init Date: Tue, 14 Feb 2017 11:37:43 +0100 Message-Id: <20170214103744.4133-2-nhaehnle@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170214103744.4133-1-nhaehnle@gmail.com> References: <20170214103744.4133-1-nhaehnle@gmail.com> MIME-Version: 1.0 Cc: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= , dri-devel@lists.freedesktop.org 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolai Hähnle As the comment says: callers of ttm_bo_init cannot rely on having the only reference to the BO when the function returns successfully. Signed-off-by: Nicolai Hähnle --- include/drm/ttm/ttm_bo_api.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index d44b8e4..7b2807f 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -521,7 +521,11 @@ extern int ttm_bo_init_top(struct ttm_bo_device *bdev, * As this object may be part of a larger structure, this function, * together with the @destroy function, * enables driver-specific objects derived from a ttm_buffer_object. - * On successful return, the object kref and list_kref are set to 1. + * + * On successful return, the caller owns an object kref to @bo. The kref and + * list_kref are usually set to 1, but note that in some situations, other + * tasks may already be holding references to @bo as well. + * * If a failure occurs, the function will call the @destroy function, or * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is * illegal and will likely cause memory corruption.