Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966769AbbLQN0J (ORCPT ); Thu, 17 Dec 2015 08:26:09 -0500 Received: from mail-ob0-f171.google.com ([209.85.214.171]:36209 "EHLO mail-ob0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934779AbbLQN0D (ORCPT ); Thu, 17 Dec 2015 08:26:03 -0500 MIME-Version: 1.0 In-Reply-To: <1450349309-8107-6-git-send-email-jonathanh@nvidia.com> References: <1450349309-8107-1-git-send-email-jonathanh@nvidia.com> <1450349309-8107-6-git-send-email-jonathanh@nvidia.com> Date: Thu, 17 Dec 2015 14:26:02 +0100 Message-ID: Subject: Re: [RFC PATCH V2 5/8] irqchip/gic: Return an error if GIC initialisation fails From: Linus Walleij To: Jon Hunter Cc: Thomas Gleixner , Jason Cooper , Marc Zyngier , Jiang Liu , Stephen Warren , Thierry Reding , Kevin Hilman , Geert Uytterhoeven , Grygorii Strashko , Lars-Peter Clausen , Soren Brinkmann , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 38 On Thu, Dec 17, 2015 at 11:48 AM, Jon Hunter wrote: > If the GIC initialisation fails, then currently we do not return an error > or clean-up afterwards. Although for root controllers, this failure may be > fatal anyway, for secondary controllers, it may not be fatal and so return > an error on failure and clean-up. > > Also for non-banked GIC controllers, make sure that we free any memory > allocated if we fail to initialise the IRQ domain. > > Signed-off-by: Jon Hunter (...) Almost perfect but... > +err: > + if (IS_ENABLED(CONFIG_GIC_NON_BANKED) && percpu_offset) { > + free_percpu(gic->dist_base.percpu_base); > + free_percpu(gic->cpu_base.percpu_base); What if the first map worked but not the second? Should it be: if (gic->dist_base.percpu_base) free_percpu(gic->dist_base.percpu_base); if (gic->cpu_base.percpu_base) free_percpu(gic->cpu_base.percpu_base); ? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/