From patchwork Fri Nov 15 09:21:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11245441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 424421393 for ; Fri, 15 Nov 2019 09:21:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A69020733 for ; Fri, 15 Nov 2019 09:21:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A69020733 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 198736E24B; Fri, 15 Nov 2019 09:21:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C29F6E20B for ; Fri, 15 Nov 2019 09:21:35 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id f3so9529875wmc.5 for ; Fri, 15 Nov 2019 01:21:35 -0800 (PST) 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=7bn7YokeAeXm5BBJ6T/lvBeGEKknPiOWxZqo9r4HuKg=; b=bRgXXweJmvqhioBqY56Ws1yBYvY4LIKlQ7EgoOdL9EphmK3KHCYVRVf+RENeCoQn0N Dvx5yw6YCD4RfkrwBGcMm8d0VRULKVoHZAr3r59pvfDTisjUE1txDYHumV1fVR2iATBX ZSwDRaWN7ENXaQB/jCN8QP8oHfIiugvGRsKdOQtPdMd4tBcHmBiCWKsjzgY7QOgjpGuh XWXPLxynvbq4A8a9IQ7eZjfwjsM0jqx2yg44gFTXMBM/lJT6o+AEZ2TrV+Nx/oWTManS qh0L2x1UZIxnMoRtGd9a4EoxM0H/AD/DtEyG/+pvvZfJKAmJFoz8GWQ8/2DVpHTKGOhz eI1w== X-Gm-Message-State: APjAAAWCMj7n/1fdjU4+mn3RNTX66dieP3EJCsWsieN5iZo0U5aSc0jn 0AUQj+ALBmHAM8lE+lgOaEArmXSu/N4= X-Google-Smtp-Source: APXvYqw5pA6Z4/To2HtwhxA8s+cQMEm12J+4VegYlzVpaDN9QcIFr5+3oidjgBd15trxx9d517+bhw== X-Received: by 2002:a1c:62c5:: with SMTP id w188mr13020645wmb.77.1573809693584; Fri, 15 Nov 2019 01:21:33 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id 11sm8987506wmi.8.2019.11.15.01.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 01:21:32 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 6/8] drm/xen: Simplify fb_create Date: Fri, 15 Nov 2019 10:21:18 +0100 Message-Id: <20191115092120.4445-7-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115092120.4445-1-daniel.vetter@ffwll.ch> References: <20191115092120.4445-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7bn7YokeAeXm5BBJ6T/lvBeGEKknPiOWxZqo9r4HuKg=; b=iPsLs/5cfYIlrdmZTkqsrS08Xzs+mb1WigGIc8UF9mWaopmOt67NMkE/lXX4F+eOoG sp3k+sinSMfKknbC2E/NHc0xpYuS/w/dMw/+BuJ86EZXz8bPRSoOq9QAXYjPCB1Yvifq U2y8J/LVbYpFVejCPFSt7NoNf07QSjEGvzgEU= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Oleksandr Andrushchenko , xen-devel@lists.xenproject.org, Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current code is a pretty good wtf moment, since we drop the reference before we use it. It's not a big deal, because a) we only use the pointer, so doesn't blow up and the real reason b) fb->obj[0] already holds a full reference for us. Might as well take the real pointer ins't of complicated games that baffle. Signed-off-by: Daniel Vetter Cc: Oleksandr Andrushchenko Cc: xen-devel@lists.xenproject.org Reviewed-by: Oleksandr Andrushchenko --- drivers/gpu/drm/xen/xen_drm_front_kms.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c index ff506bc99414..4f34c5208180 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c @@ -63,14 +63,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, if (IS_ERR_OR_NULL(fb)) return fb; - gem_obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]); - if (!gem_obj) { - DRM_ERROR("Failed to lookup GEM object\n"); - ret = -ENOENT; - goto fail; - } - - drm_gem_object_put_unlocked(gem_obj); + gem_obj = fb->obj[0]; ret = xen_drm_front_fb_attach(drm_info->front_info, xen_drm_front_dbuf_to_cookie(gem_obj),