From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbdKDVY2 (ORCPT ); Sat, 4 Nov 2017 17:24:28 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:54506 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbdKDVY0 (ORCPT ); Sat, 4 Nov 2017 17:24:26 -0400 X-Google-Smtp-Source: ABhQp+Sv1DCecEXzJvjPra49MEupD2JQW5MiXfHTxBLVsYc98hHgLt1KsWZ/cKNaFBcu6c3AxYyYhA== From: Sudip Mukherjee To: Bartlomiej Zolnierkiewicz Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 1/3] sm501fb: deallocate colormap only if allocated Date: Sat, 4 Nov 2017 21:24:19 +0000 Message-Id: <1509830661-7384-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are cases when panel and crt both are not defined and only one of them is defined and initialized. In such cases, while removing the device deallocate the colormap only if that particular fb is defined. Signed-off-by: Sudip Mukherjee --- drivers/video/fbdev/sm501fb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 076dd27..381475f 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -1889,6 +1889,9 @@ static void sm501_free_init_fb(struct sm501fb_info *info, { struct fb_info *fbi = info->fb[head]; + if (!fbi) + return; + fb_dealloc_cmap(&fbi->cmap); } -- 2.1.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sudip Mukherjee Date: Sat, 04 Nov 2017 21:24:19 +0000 Subject: [PATCH 1/3] sm501fb: deallocate colormap only if allocated Message-Id: <1509830661-7384-1-git-send-email-sudipm.mukherjee@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bartlomiej Zolnierkiewicz Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Sudip Mukherjee There are cases when panel and crt both are not defined and only one of them is defined and initialized. In such cases, while removing the device deallocate the colormap only if that particular fb is defined. Signed-off-by: Sudip Mukherjee --- drivers/video/fbdev/sm501fb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 076dd27..381475f 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -1889,6 +1889,9 @@ static void sm501_free_init_fb(struct sm501fb_info *info, { struct fb_info *fbi = info->fb[head]; + if (!fbi) + return; + fb_dealloc_cmap(&fbi->cmap); } -- 2.1.4