Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3547906pxj; Mon, 24 May 2021 09:07:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhz1UivjuqY62eJtX3q4+qELAlUS70ltW8dTVKyM83uq2XG8rSIcLztLVGafPgb76ycCo0 X-Received: by 2002:a92:cb12:: with SMTP id s18mr17000234ilo.297.1621872446528; Mon, 24 May 2021 09:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872446; cv=none; d=google.com; s=arc-20160816; b=iZqzkdNrSj5KSSrJdgYCam3RaZBF/OB130Tni+dEP13MVQiZuJorwrcRxhy8euBrDy f4NY5/95RW+u7VuCWqFh3YPCfIzASEeXiijkiZXcOcMqudliegUvosFcPYiqv2nABBeM OAbXzFv4G+k5nQl2g8PLTR2zC/lvt31epekNj4JCR8etJhbNP/uxnOJvQOZcWF8v1oUH otsZ0a6tSbpq2VMOL2Z2baeuxGAxQN9oY5rYoVvwmwUPrOOeJmg+VVeSOqSXX8VkGJX7 CGcNG51oeJ0U5aKbAhPnO72aMRECLXzp89vR3I/04QaOIODX2HWr00hKosvy7iiPwduF trIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mqd7RuCcbwXOycf0lHJ8jyBINhjrtmfJU7ZdljL+GKY=; b=dgLSDeTSdg9KAdT6iPVnnp7H4jInXTUb4nG323sBARAOeIuLdOSGJDCzC4e4qqBwYo 0t3s7OIKfGnFZdJ4RkQG8TkR2UG+N6yaoBZ626w5IzAu1itFNrTtCpq4gAspUCNHeobb l+78C9Ax7MPIrBuYZn0/mvx+pXj6pNqsB1EITgZINGIOmSJa6Ir2Y9SfIiv4Lxd0XAnP NzuN5ZK8xaCH18hGedoNxElGfzRBuKhxs2esCC6xo1c57zFR8rsX5uEM/zCx7glT/vev z3zDBAMJ8qQXEliUn9LAoUoMqisYWfSLKpko5j59lN5eqUpRSDQD+NICo5BbAW17HMBu IN3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y/A36USY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si14105368ior.12.2021.05.24.09.07.12; Mon, 24 May 2021 09:07:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y/A36USY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235449AbhEXQGL (ORCPT + 99 others); Mon, 24 May 2021 12:06:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:40482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbhEXP72 (ORCPT ); Mon, 24 May 2021 11:59:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFCA861972; Mon, 24 May 2021 15:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871118; bh=ncJtzOT3U+ZWyoeHpWPShHREqEQ2ABrlbIWDbbaSQ5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/A36USY4N/UBSpb2AXzcTQDbHPdfR9h4EKPKrQT6VXgH9aGMAHLl8VQPyM+YZhWi VO6h0sSHC8HPm+yVvBnXGpX7DBzWN7n+bkRP3xgbq9Y/OMh6bNts7jM2d3AINFO7Mg /Dt2W5Cvol09gDTa3L+VbcQ/bV724uWRekuVgqYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Daniel Vetter , stable@kernel.org Subject: [PATCH 5.12 081/127] dma-buf: fix unintended pin/unpin warnings Date: Mon, 24 May 2021 17:26:38 +0200 Message-Id: <20210524152337.591366002@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian König commit 7e008b02557ccece4d2c31fb0eaf6243cbc87121 upstream. DMA-buf internal users call the pin/unpin functions without having a dynamic attachment. Avoid the warning and backtrace in the logs. Signed-off-by: Christian König Bugs: https://gitlab.freedesktop.org/drm/intel/-/issues/3481 Fixes: c545781e1c55 ("dma-buf: doc polish for pin/unpin") Reviewed-by: Alex Deucher Reviewed-by: Daniel Vetter CC: stable@kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20210517115705.2141-1-christian.koenig@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/dma-buf/dma-buf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -760,7 +760,7 @@ dma_buf_dynamic_attach(struct dma_buf *d if (dma_buf_is_dynamic(attach->dmabuf)) { dma_resv_lock(attach->dmabuf->resv, NULL); - ret = dma_buf_pin(attach); + ret = dmabuf->ops->pin(attach); if (ret) goto err_unlock; } @@ -786,7 +786,7 @@ err_attach: err_unpin: if (dma_buf_is_dynamic(attach->dmabuf)) - dma_buf_unpin(attach); + dmabuf->ops->unpin(attach); err_unlock: if (dma_buf_is_dynamic(attach->dmabuf)) @@ -843,7 +843,7 @@ void dma_buf_detach(struct dma_buf *dmab __unmap_dma_buf(attach, attach->sgt, attach->dir); if (dma_buf_is_dynamic(attach->dmabuf)) { - dma_buf_unpin(attach); + dmabuf->ops->unpin(attach); dma_resv_unlock(attach->dmabuf->resv); } } @@ -956,7 +956,7 @@ struct sg_table *dma_buf_map_attachment( if (dma_buf_is_dynamic(attach->dmabuf)) { dma_resv_assert_held(attach->dmabuf->resv); if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) { - r = dma_buf_pin(attach); + r = attach->dmabuf->ops->pin(attach); if (r) return ERR_PTR(r); } @@ -968,7 +968,7 @@ struct sg_table *dma_buf_map_attachment( if (IS_ERR(sg_table) && dma_buf_is_dynamic(attach->dmabuf) && !IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) - dma_buf_unpin(attach); + attach->dmabuf->ops->unpin(attach); if (!IS_ERR(sg_table) && attach->dmabuf->ops->cache_sgt_mapping) { attach->sgt = sg_table;