From patchwork Sat Dec 21 03:52:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "wuxu.wu" X-Patchwork-Id: 11307863 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 5299113B6 for ; Mon, 23 Dec 2019 08:12: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 3B4C720715 for ; Mon, 23 Dec 2019 08:12:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B4C720715 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.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 0B2DA6E580; Mon, 23 Dec 2019 08:10:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7740A6E423; Sat, 21 Dec 2019 03:53:03 +0000 (UTC) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 14137746516A4DE70EEB; Sat, 21 Dec 2019 11:53:00 +0800 (CST) Received: from huawei.com (10.175.127.16) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Sat, 21 Dec 2019 11:52:49 +0800 From: wuxu.wu To: , , , Subject: [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init Date: Sat, 21 Dec 2019 11:52:29 +0800 Message-ID: <1576900349-3786-1-git-send-email-wuxu.wu@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.175.127.16] X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 23 Dec 2019 08:10:46 +0000 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: hushiyuan@huawei.com, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, wuxu.wu@huawei.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" priv porinter could be free only when priv != null and priv->rom is null. Signed-off-by: wuxu.wu --- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c index 9b91da0..d776e01 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c @@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name) (priv->rom = pci_map_rom(pdev, &priv->size))) { priv->pdev = pdev; return priv; + } else { + kfree(priv); } - kfree(priv); } pci_disable_rom(pdev); }