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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BE3F2C433FE for ; Tue, 5 Apr 2022 21:04:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EFAA10EECF; Tue, 5 Apr 2022 21:04:00 +0000 (UTC) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by gabe.freedesktop.org (Postfix) with ESMTPS id 32E4910EED3 for ; Tue, 5 Apr 2022 21:03:58 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id b19so293750wrh.11 for ; Tue, 05 Apr 2022 14:03:58 -0700 (PDT) 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=NR3Vdl26ogLJ+NN6vOMjLgqKjNNnH/ILBJ7SwyK58u4=; b=QY5BNx0SoIzeAal6axVtaWIGwfqAdaMsWa8vB8/2tMNPP79ngoZs3//A3Hs3RFU+R6 JbiNwB58Q+PxcRDo8220j5zIHq7PwJ++VWs5r56RJFIoYOvNUoC2s1njtIhMYMBrAq9m BMoGoE0hVCqQ8q0NyYd6Xdm9nb02xsjQFzVGE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NR3Vdl26ogLJ+NN6vOMjLgqKjNNnH/ILBJ7SwyK58u4=; b=zf9E6EYZBgXnsYCkQ0xKMVspe2FIwoM2qOeChE8YZGlMSGVaWkUPgq7ahoJLkhT4vF /XKTI6nJdP2FbtydprM0awc0wD9ybLzX9V6+FvfXJ0x4m8MXX20olJMXI2vxea9gfYz6 KW50XN8WArRadaD90+bYU2jtb35gXljs2IWlxUbddcstzE4Q+2HqfQUN8XICFQv3BRSu RsgzSo5aYAYIm1hFFDH5ZunksxPUIVelK5AioOfnhBaqSvD79yegRDsaYbQx52py64vi WHz7EF1ocFiqn0Jfo/KBXQHc39fA7CFDXvYaiPlZ7GbfdjkJeSkwlg9G1ZNAjaQU1RPx KTxQ== X-Gm-Message-State: AOAM530PSRaIE5Fj4ZER2AEa7PNYrPCqVKu32EO/gQKknYPvoXRCCWEL QWnBk3hSGKYhBDZLqERAo67JlXWtwY6ffBHMj1w= X-Google-Smtp-Source: ABdhPJzfMqnvu8BLZPiVWnPJQrrJt80/TvCwmVUDoPMwdBmd4TTmjknyxi2L1gtCJgD82CpXpeh6jw== X-Received: by 2002:adf:c10b:0:b0:1ed:c40f:7f91 with SMTP id r11-20020adfc10b000000b001edc40f7f91mr4063972wre.276.1649192636484; Tue, 05 Apr 2022 14:03:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id az19-20020a05600c601300b0038cadf3aa69sm4858569wmb.36.2022.04.05.14.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:03:55 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH v3 15/17] fbcon: Move more code into fbcon_release Date: Tue, 5 Apr 2022 23:03:33 +0200 Message-Id: <20220405210335.3434130-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220405210335.3434130-1-daniel.vetter@ffwll.ch> References: <20220405210335.3434130-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Du Cheng , Tetsuo Handa , Daniel Vetter , Intel Graphics Development , Claudio Suarez , Greg Kroah-Hartman , Daniel Vetter , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" con2fb_release_oldinfo() has a bunch more kfree() calls than fbcon_exit(), but since kfree() on NULL is harmless doing that in both places should be ok. This is also a bit more symmetric now again with fbcon_open also allocating the fbcon_ops structure. Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Tetsuo Handa Cc: Greg Kroah-Hartman Cc: Du Cheng Cc: Claudio Suarez --- drivers/video/fbdev/core/fbcon.c | 33 +++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index abb419a091c6..685b4a9e5546 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -690,6 +690,18 @@ static void fbcon_release(struct fb_info *info) unlock_fb_info(info); module_put(info->fbops->owner); + + if (info->fbcon_par) { + struct fbcon_ops *ops = info->fbcon_par; + + fbcon_del_cursor_work(info); + kfree(ops->cursor_state.mask); + kfree(ops->cursor_data); + kfree(ops->cursor_src); + kfree(ops->fontbuffer); + kfree(info->fbcon_par); + info->fbcon_par = NULL; + } } static int fbcon_open(struct fb_info *info) @@ -740,18 +752,10 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, static void con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, struct fb_info *newinfo) { - struct fbcon_ops *ops = oldinfo->fbcon_par; int ret; fbcon_release(oldinfo); - fbcon_del_cursor_work(oldinfo); - kfree(ops->cursor_state.mask); - kfree(ops->cursor_data); - kfree(ops->cursor_src); - kfree(ops->fontbuffer); - kfree(oldinfo->fbcon_par); - oldinfo->fbcon_par = NULL; /* If oldinfo and newinfo are driving the same hardware, the fb_release() method of oldinfo may attempt to @@ -3315,19 +3319,8 @@ static void fbcon_exit(void) } } - if (mapped) { - if (info->fbcon_par) { - struct fbcon_ops *ops = info->fbcon_par; - - fbcon_del_cursor_work(info); - kfree(ops->cursor_src); - kfree(ops->cursor_state.mask); - kfree(info->fbcon_par); - info->fbcon_par = NULL; - } - + if (mapped) fbcon_release(info); - } } } -- 2.34.1