From patchwork Sat Nov 4 21:24:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 10041795 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 2330460567 for ; Sat, 4 Nov 2017 21:24:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20744292E5 for ; Sat, 4 Nov 2017 21:24:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11A25293C9; Sat, 4 Nov 2017 21:24:28 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B825A292E5 for ; Sat, 4 Nov 2017 21:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbdKDVY1 (ORCPT ); Sat, 4 Nov 2017 17:24:27 -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 Received: by mail-wr0-f196.google.com with SMTP id o44so5276508wrf.11; Sat, 04 Nov 2017 14:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NdfBKaaFVRhaF2IKnfdxAutzVrnqvk1YZHreGUyXRN4=; b=p4VrUmBA3LwIiJURj7P8Ken0lZZeV7x6yv6TkeyBwXIxq0cnBpTGOEFtAgQGJPXAWF qbww/nBIaB7sxn9h/i5n1WIFkRovBFp2Lco50NvIrI8vlnPellZzm2fnuRXar4Q0o/BU pP8tetQ5NIhiNH1wTu5sihWQMUbpArK50kZLzMn4+znV+dYpRDYcxjzqYYlWYrLXGD6c uhwoEUdDqDEb1/7IkpLk4xLPFBbL+TyisepyhWnyCYZGT2OTTfVTNpg6QurjnWT9kdlx 6fx2UzHpOdrFK8Yi4k10ekc5XcHYOZhUKNE/eV1Lo7vRdpu/ZtSZ1QkAeUPc48MDlA53 itfg== 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=NdfBKaaFVRhaF2IKnfdxAutzVrnqvk1YZHreGUyXRN4=; b=Hts/mx2MtC2r3sIuhFdc8Y6bFpDwTWEFjURYYKeNgNVIOw3I5FOztfVTHqoeGwZO7W i7D8G8bvXHxdTYgWPcKNEe2dUgHQ7TzEhT2yDBvuHz/kXX67NIxwGra51aW2ANPKIJe4 +NkRLyhOXPmOU3a3le3Y2HHcWaJwqTh9SqS/JkkATJWyhalsnVHOVMk5OpQtjyQOb/CJ o6sTU44pK4YQzJriNKnrJ0ZsPvK4T1SpfWaS7heBRWiVuLRhtK4t84Q2UkHgd8BXyfp3 yTkStRZlWAdKiUiyhbBgW3K5xEKy7KH5brBZT/dso7vS88dMSjCNGop0z3lyj88Fci3H AHvw== X-Gm-Message-State: AJaThX7brwVu4320+NTkCKjhdgKIV2G285YjWhftCXvFYbfHZtH8wzfp 5O0tBHXez8CIylAAmSxTclc= X-Google-Smtp-Source: ABhQp+Sv1DCecEXzJvjPra49MEupD2JQW5MiXfHTxBLVsYc98hHgLt1KsWZ/cKNaFBcu6c3AxYyYhA== X-Received: by 10.223.178.130 with SMTP id g2mr552495wrd.129.1509830665039; Sat, 04 Nov 2017 14:24:25 -0700 (PDT) Received: from localhost.localdomain (cpc101300-bagu16-2-0-cust362.1-3.cable.virginm.net. [86.21.41.107]) by smtp.gmail.com with ESMTPSA id c17sm11658353wrg.26.2017.11.04.14.24.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Nov 2017 14:24:24 -0700 (PDT) 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-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }