From patchwork Fri Feb 21 21:02:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11397379 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 F00E51580 for ; Fri, 21 Feb 2020 21:04:03 +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 CE6EC2073A for ; Fri, 21 Feb 2020 21:04:03 +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="HmHnKc8O" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE6EC2073A 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 E7BB46F52A; Fri, 21 Feb 2020 21:03:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F8736F522 for ; Fri, 21 Feb 2020 21:03:41 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id r11so3524428wrq.10 for ; Fri, 21 Feb 2020 13:03:41 -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=q7MWd5yKDDN4kYPLlNzre71uaGPyUp7BlB0OXWxic1I=; b=HmHnKc8O3LaXCEq6vibOoz4VL3wFj2DwDlFe7VDIA5K0lefT/mmHJW20b+GpwRX/1i Pgl2bYI+DkoCskYja46KSzbjQG2snq3D2QHKITyTBHLMtXIpO3DiJmg/3L01ISWHy6Lw m7L2/lmvDTmVF08D/+m/WTCq1whSLP8U1fA4o= 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=q7MWd5yKDDN4kYPLlNzre71uaGPyUp7BlB0OXWxic1I=; b=HDhnVCshcBJiKxHw7AK1XGZGjs79tyFaAV0qqMkdZFPJCGRjpVdpVp4voa0Mz99PF+ twX79iG/A5GarXtFpigry9vn90vyA7bKWAP6qn3ms+c4L3eV+Ho7DjpqtnS00/6wtp3w CXJYSmDv3Gbyj+R0P0iYGrTDi2J+8/MtVS0CfpCJlbhIJPCobQ33wkbmyuB6idvTmXbs TiI1TYWmLL9cU6E9DyrO/eBpZ2NLulLZfw+WTKskh0CVjyCGe3mRS43XmH93OmSbcgb2 qTbUr5oV/f/imUxGXQIjz9mdStybcDzmFfCC/pmgq1FtZXkttNpiYc+PCC5bntqvHRPk QQzw== X-Gm-Message-State: APjAAAWNCLU5sKASFksTb2VTNElZJpy0pxzn86Dns4qxmYKJKs7PHOAT wGA9nf+bAjMI4jXLzakLtp0YaQ== X-Google-Smtp-Source: APXvYqwAfatSmqdVJs2mNGL8TD1RsnWLfWQUrfOI/1wgGKW9rAsKOL1Jvx9d9aWptOyihWl290STdQ== X-Received: by 2002:adf:eb51:: with SMTP id u17mr53747250wrn.29.1582319019850; Fri, 21 Feb 2020 13:03:39 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id z6sm5483930wrw.36.2020.02.21.13.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 13:03:39 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Fri, 21 Feb 2020 22:02:37 +0100 Message-Id: <20200221210319.2245170-10-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200221210319.2245170-1-daniel.vetter@ffwll.ch> References: <20200221210319.2245170-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 09/51] drm/cirrus: 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 , virtualization@lists.linux-foundation.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Gerd Hoffmann , Thomas Zimmermann , Daniel Vetter , Dave Airlie , Sam Ravnborg , Linus Walleij Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" With this we can drop the final kfree from the release function. I also noticed that cirrus forgot to call drm_dev_fini(). v2: Don't call kfree(cirrus) after we've handed overship of that to drm_device and the drmm_ stuff. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Linus Walleij Cc: Sam Ravnborg Cc: Thomas Zimmermann Cc: virtualization@lists.linux-foundation.org --- drivers/gpu/drm/cirrus/cirrus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index d2ff63ce8eaf..2232556ce34c 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -527,10 +528,8 @@ static void cirrus_mode_config_init(struct cirrus_device *cirrus) static void cirrus_release(struct drm_device *dev) { - struct cirrus_device *cirrus = dev->dev_private; - drm_mode_config_cleanup(dev); - kfree(cirrus); + drm_dev_fini(dev); } DEFINE_DRM_GEM_FOPS(cirrus_fops); @@ -575,9 +574,12 @@ static int cirrus_pci_probe(struct pci_dev *pdev, dev = &cirrus->dev; ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev); - if (ret) - goto err_free_cirrus; + if (ret) { + kfree(cirrus); + goto err_pci_release; + } dev->dev_private = cirrus; + drmm_add_final_kfree(dev, cirrus); ret = -ENOMEM; cirrus->vram = ioremap(pci_resource_start(pdev, 0), @@ -618,8 +620,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev, iounmap(cirrus->vram); err_dev_put: drm_dev_put(dev); -err_free_cirrus: - kfree(cirrus); err_pci_release: pci_release_regions(pdev); return ret;