From patchwork Mon Jan 29 14:47:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10191419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2673360388 for ; Tue, 30 Jan 2018 08:24:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16D00289A9 for ; Tue, 30 Jan 2018 08:24:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B821289AB; Tue, 30 Jan 2018 08:24:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D4F5289A9 for ; Tue, 30 Jan 2018 08:24:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 992976E59F; Tue, 30 Jan 2018 08:24:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 191C86E542; Mon, 29 Jan 2018 14:47:41 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id g21so7479505wrb.13; Mon, 29 Jan 2018 06:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=FNdfDPWZvj0IEjjMo8FrJkLoYBJeBHfzRSNaMZdRCzk=; b=mBeoHR2bimdmiXqo8jeZjmSo1Y3vwcabMXxoFPTJduzJ5t7qSB+EQR3Gc/2ANzykJ7 fOx/yp+DYPSdDkZ96URKUZw0Irem9HhtTZUis24q2B4StQXDRwg8r7aw4as9r+KyoD9W gbyKPWwVrBi5HQGj07dDWmPDKgTbKB4iC4QIGkxRzDNIr7YwJGTies0n6zad1YHF01uQ D+nw0mFFHjoxdvZIhMZ3bEj7JhdjWuKgaPTARwSN3VVAkoWuK1D0WOGVhPsijScuSxj1 0m3De+Br0ftIsFqSdAOfvbEGR+LFvbpueITBjPko1UcvddB8pf1HNOz+PJIdIMoNF6iC +6+w== 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; bh=FNdfDPWZvj0IEjjMo8FrJkLoYBJeBHfzRSNaMZdRCzk=; b=NCMpihOboqV00DlUqFo8YoKpRAnY1XQNPsFI0t21L3l3eqM+MnNgDCc9eTkMZ0Lm0G p1iP+IjTY5dMw1SjpgOZ7ZycHHdqMEkJfWKiqbqmUPeAcYwZVyekL7hAnOT+8wMnX7me 1eR+dVQhmLm67IUI/zqcM4LCjhcIqBNjO9lECcUh8hvmV1bIfZu3QIcWC1TD0uL86G7z YRno36l/12jT2+LC4/YIqI2fXEiN+NYy2FTxfT0yWSNsQ4+O+odnyGNtf1UpgyxhUP5A BiilNzfnlQkC9HT0wPt3k5mHLonViSzXg+7d5CIt3CwZcKL4jhHvbnTj7YhSrqIQ6Eo4 07Mg== X-Gm-Message-State: AKwxytdkp/fXimD3RYqftCBLc8CmiCWvATX4tawSNFsyb+WugI48ZT8L BYV5ggqOdyZTC06IryOisck= X-Google-Smtp-Source: AH8x226Kp+o5SHldDjax2hYt/aj5JQm7mMsvIoDipAz7WpcapNhq1mWDtCF4tEBu1dVWQrI0BMBxFQ== X-Received: by 10.223.139.156 with SMTP id o28mr18652416wra.165.1517237260619; Mon, 29 Jan 2018 06:47:40 -0800 (PST) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id b9sm12171864wmc.14.2018.01.29.06.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2018 06:47:39 -0800 (PST) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Subject: [PATCH 1/2] drm/i915: Free memdup-ed bios data structures on driver_unload Date: Mon, 29 Jan 2018 15:47:34 +0100 Message-Id: <20180129144735.32412-1-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 X-Mailman-Approved-At: Tue, 30 Jan 2018 08:24:15 +0000 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: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a new intel_bios_cleanup function to free memdup-ed bios data structures and call it from i915_driver_unload(). Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_bios.c | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 1ec12add34b2..4ecf41724183 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1437,6 +1437,8 @@ void i915_driver_unload(struct drm_device *dev) intel_modeset_cleanup(dev); + intel_bios_cleanup(dev_priv); + /* * free the memory space allocated for the child device * config parsed from VBT diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 454d8f937fae..081190da0818 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3663,6 +3663,7 @@ extern void intel_i2c_reset(struct drm_i915_private *dev_priv); /* intel_bios.c */ void intel_bios_init(struct drm_i915_private *dev_priv); +void intel_bios_cleanup(struct drm_i915_private *dev_priv); bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin); diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 95f0b310d656..64a0d55df28e 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -1588,6 +1588,17 @@ void intel_bios_init(struct drm_i915_private *dev_priv) pci_unmap_rom(pdev, bios); } +/** + * intel_bios_cleanup - Free any resources allocated by intel_bios_init() + * @dev_priv: i915 device instance + */ +void intel_bios_cleanup(struct drm_i915_private *dev_priv) +{ + kfree(dev_priv->vbt.dsi.data); + kfree(dev_priv->vbt.dsi.pps); + kfree(dev_priv->vbt.dsi.config); +} + /** * intel_bios_is_tv_present - is integrated TV present in VBT * @dev_priv: i915 device instance