From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D72C433EF for ; Mon, 10 Jan 2022 18:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238814AbiAJSMs (ORCPT ); Mon, 10 Jan 2022 13:12:48 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:44422 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238786AbiAJSMs (ORCPT ); Mon, 10 Jan 2022 13:12:48 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1641838366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2zo1GoaegfwLq8ByWLgrCdt6kQL15RfNmR27qdFkCXs=; b=wg+0jYPkfyXBANMF9DrbB1VZY/A2H3NxCDNL0PdKZaQjveELygI6vChYjpmK8mezF1B8JM 3Q6Fgd45hThR6NFyrAztLFQW0Du/St5l9y9ZtElwgFl9NDDq0PXVzJtEVKov8EaNRDZ81L eVdqnmysikOkVjpjAg882Gsjz6yZ54Uctmk12wQHCofZiwWVPnCbHkpvv4tDyYO3vZLG9w e64U20W7FggbG9+ID3eENSFzucC7Eorc5fEgfrJ4OKYz0CE6hPEZM+Xgk2ce8kuvb0VAsa X3V2Ri9KCwv0+VUgAxjPNl/CVqXJXoiumYuNcRD9koqxMMscv8p75zWFHCgf8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1641838366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2zo1GoaegfwLq8ByWLgrCdt6kQL15RfNmR27qdFkCXs=; b=1JyyFqm//sjHNxcOA43/6zXwebeoZM76NF5Ms6lFcm7i8cDw3SAOwzaBpYafr8eAGkMdhU XC6nlPN+OSbMq8AQ== To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Cedric Le Goater , xen-devel@lists.xenproject.org, Juergen Gross , Greg Kroah-Hartman , Niklas Schnelle , linux-s390@vger.kernel.org, Heiko Carstens , Christian Borntraeger , Logan Gunthorpe , Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com Subject: [patch] genirq/msi: Populate sysfs entry only once In-Reply-To: <20211206210749.224917330@linutronix.de> References: <20211206210600.123171746@linutronix.de> <20211206210749.224917330@linutronix.de> Date: Mon, 10 Jan 2022 19:12:45 +0100 Message-ID: <87leznqx2a.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org The MSI entries for multi-MSI are populated en bloc for the MSI descriptor, but the current code invokes the population inside the per interrupt loop which triggers a warning in the sysfs code and causes the interrupt allocation to fail. Move it outside of the loop so it works correctly for single and multi-MSI. Fixes: bf5e758f02fc ("genirq/msi: Simplify sysfs handling") Reported-by: Borislav Petkov Signed-off-by: Thomas Gleixner --- kernel/irq/msi.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -887,12 +887,11 @@ int __msi_domain_alloc_irqs(struct irq_d ret = msi_init_virq(domain, virq + i, vflags); if (ret) return ret; - - if (info->flags & MSI_FLAG_DEV_SYSFS) { - ret = msi_sysfs_populate_desc(dev, desc); - if (ret) - return ret; - } + } + if (info->flags & MSI_FLAG_DEV_SYSFS) { + ret = msi_sysfs_populate_desc(dev, desc); + if (ret) + return ret; } allocated++; }