From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Salomon Subject: Re: [Linux-fbdev-devel] [PATCH 14/15] amifb: check fb_alloc_cmap return value and handle failure properly Date: Mon, 9 Feb 2009 16:51:31 -0500 Message-ID: <20090209165131.4c625d4c@ephemeral> References: <20090207121857.6bc5d5bc@ephemeral> <20090209212629.611bd99d.krzysztof.h1@wp.pl> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090209212629.611bd99d.krzysztof.h1@wp.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Krzysztof Helt Cc: Andrew Morton , linux-fbdev-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, adaplas@gmail.com On Mon, 9 Feb 2009 21:26:29 +0100 Krzysztof Helt wrote: > On Sat, 7 Feb 2009 12:18:57 -0500 > Andres Salomon wrote: > > > > > Signed-off-by: Andres Salomon > > --- > > Acked-by: Krzysztof Helt > > One comment below. [...] > > @@ -2456,7 +2458,8 @@ amifb_error: > > > > static void amifb_deinit(void) > > { > > - fb_dealloc_cmap(&fb_info.cmap); > > + if (fb_info.cmap.len) > > + fb_dealloc_cmap(&fb_info.cmap); > > Again, is the "if(fb_info.cmap.len)" needed here? Yep; amifb_deinit is called from amifb_init in the case of errors. This can happen before fb_alloc_cmap is called (but after the memory region has been requested), so we need to explicitly check that cmap memory has been allocated.