From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD21C34047 for ; Wed, 19 Feb 2020 14:39:41 +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 08DDC24654 for ; Wed, 19 Feb 2020 14:39:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VASj8ZQs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08DDC24654 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com 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 6C9BF6EC0C; Wed, 19 Feb 2020 14:39:40 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36EDB891EC; Wed, 19 Feb 2020 14:39:39 +0000 (UTC) Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 458262F9; Wed, 19 Feb 2020 15:39:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582123177; bh=J4hmOOjdtJyZjtQ+Bt1KQOWXYZXnGF0H2DZDFhKcAeQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VASj8ZQsbA8c4aPhUp6Z5XpwwLPPIO3c2Eh53Yo7xIlHZ2rSXE+ow5XY5XRP8cn2b 5ZCOIry4i3YvXFVDPS8g2pUg/xaXpAu085oYAGU7lrNBpjDhTDtKhUWaJp9wOaGRmt I/PKV4i3fQTOAKXajKr7U0pyndZPv97YXLflgQOM= Date: Wed, 19 Feb 2020 16:39:18 +0200 From: Laurent Pinchart To: Daniel Vetter Subject: Re: [PATCH 19/52] drm/: Use drmm_add_final_kfree Message-ID: <20200219143918.GN5070@pendragon.ideasonboard.com> References: <20200219102122.1607365-1-daniel.vetter@ffwll.ch> <20200219102122.1607365-20-daniel.vetter@ffwll.ch> <20200219141116.GJ5070@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development , Liviu Dudau , Russell King , DRI Development , Hans de Goede , "James \(Qian\) Wang" , Daniel Vetter , Mihail Atanassov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Daniel, On Wed, Feb 19, 2020 at 03:30:59PM +0100, Daniel Vetter wrote: > On Wed, Feb 19, 2020 at 3:11 PM Laurent Pinchart wrote: > > On Wed, Feb 19, 2020 at 11:20:49AM +0100, Daniel Vetter wrote: > > > These are the leftover drivers that didn't have a ->release hook that > > > needed to be updated. > > > > > > Signed-off-by: Daniel Vetter > > > Cc: "James (Qian) Wang" > > > Cc: Liviu Dudau > > > Cc: Mihail Atanassov > > > Cc: Russell King > > > Cc: Hans de Goede > > > --- > > > drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 ++ > > > drivers/gpu/drm/armada/armada_drv.c | 2 ++ > > > drivers/gpu/drm/vboxvideo/vbox_drv.c | 2 ++ > > > 3 files changed, 6 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > > index 442d4656150a..16dfd5cdb66c 100644 > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > > @@ -14,6 +14,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > > > > @@ -271,6 +272,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > > > err = drm_dev_init(drm, &komeda_kms_driver, mdev->dev); > > > if (err) > > > goto free_kms; > > > + drmm_add_final_kfree(drm, kms); > > > > Instead of sprinkling calls to drmm_add_final_kfree() everywhere, > > wouldn't it be better to pass the parent pointer to drm_dev_init() ? > > Would lead to a horrendous monster patch, and even with this splitting > there were a few corner cases. It could be generated by coccinelle, with the semantic patch included in the commit message, so that regenerating it should be possible when merging if conflict arise. > My plan is to add a devm_drm_dev_alloc > pattern which combines the usual pattern that most drivers use, see > the last patch for all these glorious ideas. OK I will. > So yeah I hope this will all go away (or mostly at least), but for > bisecting I didn't come up with a better idea to get this all off the > ground unfortunately. > > > > > > > drm->dev_private = mdev; > > > > > > diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c > > > index 197dca3fc84c..dd9ed71ed942 100644 > > > --- a/drivers/gpu/drm/armada/armada_drv.c > > > +++ b/drivers/gpu/drm/armada/armada_drv.c > > > @@ -12,6 +12,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -103,6 +104,7 @@ static int armada_drm_bind(struct device *dev) > > > kfree(priv); > > > return ret; > > > } > > > + drmm_add_final_kfree(&priv->drm, priv); > > > > > > /* Remove early framebuffers */ > > > ret = drm_fb_helper_remove_conflicting_framebuffers(NULL, > > > diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c > > > index 8512d970a09f..13eaae7921f5 100644 > > > --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c > > > +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c > > > @@ -17,6 +17,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include "vbox_drv.h" > > > > > > @@ -54,6 +55,7 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > > vbox->ddev.pdev = pdev; > > > vbox->ddev.dev_private = vbox; > > > pci_set_drvdata(pdev, vbox); > > > + drmm_add_final_kfree(&vbox->ddev, vbox); > > > mutex_init(&vbox->hw_mutex); > > > > > > ret = pci_enable_device(pdev); -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel