From patchwork Wed Feb 15 19:10:55 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: 9574835 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 DB45060493 for ; Wed, 15 Feb 2017 19:11:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE55F284CE for ; Wed, 15 Feb 2017 19:11:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C345D284DA; Wed, 15 Feb 2017 19:11:17 +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 8AC0F284CE for ; Wed, 15 Feb 2017 19:11:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9B126E9DB; Wed, 15 Feb 2017 19:11:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABECA6E9D0; Wed, 15 Feb 2017 19:11:10 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id k90so32232006wrc.3; Wed, 15 Feb 2017 11:11:10 -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=bN7EkEnAIo+1CfsnHVdn6pgcjCsuHNI6sfGE66eoa98=; b=A1mj1BsPesgQtU2YlRKLzMtWtZVVzUbgLWJkWZJSdpEJOnvF+CbxAoIj7757eYhC/t z36YM3WbiD1Ny9US2ONmM44sgGVhhzuk7v4DoAzyX0vVcsBqNeQLPDMlxTXu2+4umoBc jWWnWzeR3tUTX3V5zvS47XFocH7FWAg+sybXjOc4l3Ug3PUrtg0iA7mM3J91kq2HcxLK OTknK6hkDRskaOnwlHgt5yAN0wz47VbFdxnbKIDLANMSA0vU+fHg9C06J7l72d4pEilI bSGwC7Yg/DsTlDiBpQ6ojip6JCD3XBJ2YtdUGO9sfq5GZ+ZKwTo8CxvjRGDRLOtaAkTJ ycqg== 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=bN7EkEnAIo+1CfsnHVdn6pgcjCsuHNI6sfGE66eoa98=; b=N9sDtI9DxQSAPLmsVnOGI9oB/U5rySX3qjUAZAmMF9WZJdPuKa3euS2PDYAWn6KYe3 hw75zabG5BcGAxXbL+LtyndUIFh4TZW+B5KodP0hoQ9+F7rOCX9nD5/oSiHURF08ndNw hYQBWA9dYHi3uGKcGKFX6yn4kWBCHRE6PP93y6nYHv+8ItiPOX7fRUXz+/eB20XFCCGR 0DKKE58XL0Mxg79u2vSc/4ZFBOBL1InSk48bhcO0EpM7hFM7ozzZCqWXGY3BXXatqSHm lkuQ9bkcwadPU2mXtYFnHfqTxgKdd15x7or5LP1fvAUHXgRqrabJmdjFTeVSzc1Xivw6 RJjg== X-Gm-Message-State: AMke39kv4U9hHpRhRy42dLjC0bFlFGnkn/jX8L1Jz9AbzmsOGos3HmPERnKF0/4E9RbxxQ== X-Received: by 10.223.154.114 with SMTP id z105mr31445236wrb.89.1487185869073; Wed, 15 Feb 2017 11:11:09 -0800 (PST) Received: from capella.localdomain (x55b54b64.dyn.telefonica.de. [85.181.75.100]) by smtp.gmail.com with ESMTPSA id w204sm440510wmd.17.2017.02.15.11.11.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2017 11:11:08 -0800 (PST) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: amd-gfx@lists.freedesktop.org Subject: [PATCH v2 2/3] drm/ttm: fix the documentation of ttm_bo_init Date: Wed, 15 Feb 2017 20:10:55 +0100 Message-Id: <20170215191056.17718-2-nhaehnle@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170215191056.17718-1-nhaehnle@gmail.com> References: <20170215191056.17718-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 6e8eaee..5add713 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -520,7 +520,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.