From patchwork Tue Aug 4 21:53:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 6944721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D0AD9F358 for ; Tue, 4 Aug 2015 21:56:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5E6020553 for ; Tue, 4 Aug 2015 21:56:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DABC9204E3 for ; Tue, 4 Aug 2015 21:56:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMkAA-0000au-Av; Tue, 04 Aug 2015 21:54:22 +0000 Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMkA7-0000XP-VO for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2015 21:54:20 +0000 Received: by iodd187 with SMTP id d187so31154501iod.2 for ; Tue, 04 Aug 2015 14:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=946fTIT/eMyt8sO/h90fMNjGe900RkKjMg7QPBziJ7M=; b=YNAO/sC5AfP30gU9H6sI6P1j3Kg3h6rFRWkeGSonktrpajyj/0CKtCbrwo+95ExXza Id9ejzfc7kBbOypWLGIkkjRn1ZuDJ3Mh8kWuaj98i1OnzbHxdfCk0rDKGTsNdmz1ib7T fohDu7FaiPDAEc/LiOLgDlivIozL/UJOwlk2aawQWVO3gexYlUV2saDSVoQzZwKuYiQc eu0Ik7AAGWEX5NZH+xfWiYQs+bupbvZ0WRX1SNifC7lRz8xWXVApe0D+1LW+ZOqTptRn xjX6TqNB2pbBYmE6AICnAOlJhS/qjRWpQd1rdGKqphgar0XIcom4cMv5pn9BB7pT9gmM 7o0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=946fTIT/eMyt8sO/h90fMNjGe900RkKjMg7QPBziJ7M=; b=iIcAPy0y6/FyEzFkf4967l3xbRVorATPB/cvd7Q/MiQXxCfNFBSszMsKNopyOBXpOW frec/tlmvkJCOYGQmTNslfSBAcQ0+fyptfyQDV1SSFav4oPVBbPpjPOM0YHVYmLeqTks IrHDz7yykelh+pKHcmTxkRiLcJlnI6T6StRxxqQuLmo0YbKi3rN6AhT7fMEMC7NSzF5R tyLWTMLdQ+GQN30i1N0Wyxyx9tKRabBcle8PUFv0SkOONs4Sq0CYAxcmmxRQS0fBDFm6 7Uy7wWGUftSYYof/pFKgclDhNwjD1heDuoRZ+TRRHKSzb/9VUsVR81Y1/wPXwDeSPtS3 sbzQ== X-Gm-Message-State: ALoCoQn9NdgmaZhlhG+1xKTlvcFHS+BySP+FQm7lNPvvkoGguj7b3xKIMxxukBdVk8Huh0m+BIWX X-Received: by 10.107.166.72 with SMTP id p69mr7352071ioe.65.1438725239084; Tue, 04 Aug 2015 14:53:59 -0700 (PDT) Received: from localhost ([69.71.1.1]) by smtp.gmail.com with ESMTPSA id ha3sm1338996igb.15.2015.08.04.14.53.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Aug 2015 14:53:58 -0700 (PDT) Subject: [PATCH v5 1/9] ARM/PCI: Replace panic with WARN messages on failures To: Lorenzo Pieralisi From: Bjorn Helgaas Date: Tue, 04 Aug 2015 16:53:57 -0500 Message-ID: <20150804215357.9189.11942.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150804214234.9189.42548.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150804214234.9189.42548.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150804_145420_063600_E085815E X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Duc Dang , Russell King , Arnd Bergmann , Gabriele Paoloni , Marc Zyngier , linux-pci@vger.kernel.org, Pratyush Anand , Michal Simek , Simon Horman , James Morse , Tanmay Inamdar , Jingoo Han , Thierry Reding , Jayachandran C , linux-arm-kernel@lists.infradead.org, Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lorenzo Pieralisi In the ARM PCI bios32 layer, failures to dynamically allocate pci_sys_data for a PCI bus, or a PCI bus scan failure have to be considered serious warnings but they should not trigger a system panic so that at least the system is given a chance to be debugged. This patch replaces the panic statements with WARN() messages to improve error reporting in the ARM PCI bios32 layer. Signed-off-by: Lorenzo Pieralisi Signed-off-by: Bjorn Helgaas Acked-by: Marc Zyngier CC: Russell King CC: Marc Zyngier Reviewed-by: Jingoo Han --- arch/arm/kernel/bios32.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index bf370bc..4e95260 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -459,8 +459,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, for (nr = busnr = 0; nr < hw->nr_controllers; nr++) { sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL); - if (!sys) - panic("PCI: unable to allocate sys data!"); + if (WARN(!sys, "PCI: unable to allocate sys data!")) + break; #ifdef CONFIG_PCI_MSI sys->msi_ctrl = hw->msi_ctrl; @@ -489,8 +489,10 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, sys->bus = pci_scan_root_bus(parent, sys->busnr, hw->ops, sys, &sys->resources); - if (!sys->bus) - panic("PCI: unable to scan bus!"); + if (WARN(!sys->bus, "PCI: unable to scan bus!")) { + kfree(sys); + break; + } busnr = sys->bus->busn_res.end + 1;