From patchwork Fri Feb 8 19:28:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2117731 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 03964E00C6 for ; Fri, 8 Feb 2013 19:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760357Ab3BHT27 (ORCPT ); Fri, 8 Feb 2013 14:28:59 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:33341 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760341Ab3BHT26 (ORCPT ); Fri, 8 Feb 2013 14:28:58 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r18JSg6M023146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Feb 2013 19:28:42 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r18JSdb8006964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Feb 2013 19:28:41 GMT Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r18JScCB010332; Fri, 8 Feb 2013 13:28:38 -0600 Received: from linux-siqj.site (/10.132.127.230) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Feb 2013 11:28:38 -0800 From: Yinghai Lu To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Bjorn Helgaas , "Rafael J. Wysocki" Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v2 18/26] genirq: Bail out early in free_desc() Date: Fri, 8 Feb 2013 11:28:15 -0800 Message-Id: <1360351703-20571-19-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360351703-20571-1-git-send-email-yinghai@kernel.org> References: <1360351703-20571-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org We pre-reserve irq range for hot-added ioapic, and later only some are used via realloc. So during hot-remove, we need to clear bits in allocated_irqs for both case. Check if the irq_desc is there at first, and bail out early if irq_desc is not allocated yet. So we can use irq_free_descs to clear allocated_irqs bits for preserved irqs. Signed-off-by: Yinghai Lu --- kernel/irq/irqdesc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index b48f65b..32f099e 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -170,6 +170,9 @@ static void free_desc(unsigned int irq) { struct irq_desc *desc = irq_to_desc(irq); + if (!desc) + return; + unregister_irq_proc(irq, desc); mutex_lock(&sparse_irq_lock);