From patchwork Mon Mar 2 22:25:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11416509 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 B631C1820 for ; Mon, 2 Mar 2020 22:27:07 +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 949D320866 for ; Mon, 2 Mar 2020 22:27:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="jXYlYRLy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 949D320866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD0566E86E; Mon, 2 Mar 2020 22:26:52 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70A0F6E86E for ; Mon, 2 Mar 2020 22:26:50 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id q8so1875391wrm.4 for ; Mon, 02 Mar 2020 14:26:50 -0800 (PST) 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=WRBxH0UCFajRt6MVgdCo43fKAPtVFRLlI7EEwc3+Zq0=; b=jXYlYRLy+N/HxfLo1E2oesc7ekl588Hs1A9jj1h3j2jszmyUvfjWJJTFJ/rQ29ZJPn L+aWJHlsMR7FoQ8erNLgXWlobtJlXC6DRN5rumnpIZWzXjmxUs+l/V2Rb6SpTN3tnAO5 LZZr8npFjPKIOc3MIWSL74QkkWw/0kmwnb3zk= 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=WRBxH0UCFajRt6MVgdCo43fKAPtVFRLlI7EEwc3+Zq0=; b=Ga2om8jN305G4nRa2IIzUE7Vw3JNL5gfEBvHxn8uR0gb37VNzDCuJ3hRJJyF268h6+ 6D2iLTbDewKCBgogp5Oh64sHmR/0lSmol3XlLuUrZYVAjTF0gEFhd7empWn9Czual0P4 a+nyngK8qxuJhCf4GXJKo1l4rJwgQPFM9LtKH+s6QVCIE5HHxHGr94+NoXSItApunShE eyMbxhraFT57aodd65Ecw6SQqngQe+pfyAm4jxPc1/r6Qj/aD/Vz6lQeh4WQYoXG9hAC cCnxkUH7bI59arsDyI7Y+5lisqc8paeVRqwAL8AUPq3Bkvtr1lJjYuaYVWDwRH1Kd7Hk 0ADA== X-Gm-Message-State: ANhLgQ0eUcHNY45TXphLGt1Q+OOJpVZGSFziC0wBlsVJM9rkkG9YdNqq W4n9WIZTBrMeHfA+hVqaIdZJPQ== X-Google-Smtp-Source: ADFU+vvY3T2tq/AXrfwd3VMdtrhHM9eziC+dY1f7z0SuK5J1FC2Ljf374dAPE/tGGSAE8rtAlWI7uQ== X-Received: by 2002:a5d:6284:: with SMTP id k4mr1653787wru.398.1583188009204; Mon, 02 Mar 2020 14:26:49 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id o18sm26114589wrv.60.2020.03.02.14.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 14:26:48 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Mon, 2 Mar 2020 23:25:46 +0100 Message-Id: <20200302222631.3861340-7-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200302222631.3861340-1-daniel.vetter@ffwll.ch> References: <20200302222631.3861340-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 06/51] drm/udl: Use drmm_add_final_kfree X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , =?utf-8?q?Nor?= =?utf-8?q?alf_Tr=C3=B8nnes?= , Laurent Pinchart , Thomas Zimmermann , Daniel Vetter , Dave Airlie , Thomas Gleixner , Sam Ravnborg Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" With this we can drop the final kfree from the release function. v2: We need drm_dev_put to unroll the driver creation (once drm_dev_init and drmm_add_final_kfree suceeded), otherwise the drmm_ magic doesn't happen. v3: Actually squash in the fixup (Laurent). Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Laurent Pinchart Cc: Dave Airlie Cc: Sean Paul Cc: Thomas Zimmermann Cc: Emil Velikov Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Thomas Gleixner Cc: Sam Ravnborg Acked-by: Thomas Zimmermann --- drivers/gpu/drm/udl/udl_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index e6c1cd77d4d4..6a5594946096 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,6 @@ static void udl_driver_release(struct drm_device *dev) udl_fini(dev); udl_modeset_cleanup(dev); drm_dev_fini(dev); - kfree(dev); } static struct drm_driver driver = { @@ -77,11 +77,11 @@ static struct udl_device *udl_driver_create(struct usb_interface *interface) udl->udev = udev; udl->drm.dev_private = udl; + drmm_add_final_kfree(&udl->drm, udl); r = udl_init(udl); if (r) { - drm_dev_fini(&udl->drm); - kfree(udl); + drm_dev_put(&udl->drm); return ERR_PTR(r); }