From patchwork Sat Nov 27 01:20:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12641785 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 45F62C433EF for ; Sat, 27 Nov 2021 01:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344510AbhK0B0T (ORCPT ); Fri, 26 Nov 2021 20:26:19 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:37388 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345412AbhK0BYH (ORCPT ); Fri, 26 Nov 2021 20:24:07 -0500 Message-ID: <20211126230524.295122054@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637976016; 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: references:references; bh=Oh8EM+g3S/QfSPoDjrJmTy+Z80Zsw+m+X3NUsXacOTE=; b=qVZGDbNZ2EPWgWKeie9Lsg8SlBXlB0cdjwpWi66yeNG4DYIWMBeGOpSML8TzTYX+IBXTLC MytS9/7pPDvx+5uOdmMK7tsJf7Ty5rDTRSyLyz3rUILaGDpD78K/KinpA9spc//yXsu3gN es43eYzq8WxrwsxRBJzulVPjdWWxECSfHrNvVbIpbHXTO4du8HBL66WTL0tQYDkuwnrV1V PPHrx45+4UKv8DU+YAJ7euQ68e3XyTtqHvf2s+uztrRavCQ0DyLPUn8PCzZD6IvxFPHea8 bXkbZI3WH5L+7y2A9eEGs9xy4p0pSnnPxY75sPwFeTWsH96Mo6TP/W1vzRoDBw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637976016; 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: references:references; bh=Oh8EM+g3S/QfSPoDjrJmTy+Z80Zsw+m+X3NUsXacOTE=; b=xOkGJjLxWWpLTjyaY3a3wt1jNJ6brnrPkO+LEWpUUYBkEz0HM87BkrlRzK6xnt7ICAcZBo 9lh6ntzQZMTtE/BA== From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Greg Kroah-Hartman , Stuart Yoder , Laurentiu Tudor , Santosh Shilimkar , iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org, Nishanth Menon , Tero Kristo , linux-arm-kernel@lists.infradead.org, x86@kernel.org, Vinod Koul , Mark Rutland , Will Deacon , Sinan Kaya Subject: [patch 06/37] bus: fsl-mc-msi: Allocate MSI device data on first use References: <20211126224100.303046749@linutronix.de> MIME-Version: 1.0 Date: Sat, 27 Nov 2021 02:20:16 +0100 (CET) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Allocate the MSI device data on first invocation of the allocation function. Signed-off-by: Thomas Gleixner Cc: Stuart Yoder Cc: Laurentiu Tudor --- drivers/bus/fsl-mc/fsl-mc-msi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/bus/fsl-mc/fsl-mc-msi.c +++ b/drivers/bus/fsl-mc/fsl-mc-msi.c @@ -253,6 +253,14 @@ int fsl_mc_msi_domain_alloc_irqs(struct struct irq_domain *msi_domain; int error; + msi_domain = dev_get_msi_domain(dev); + if (!msi_domain) + return -EINVAL; + + error = msi_setup_device_data(dev); + if (error) + return error; + if (!list_empty(dev_to_msi_list(dev))) return -EINVAL; @@ -260,12 +268,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct if (error < 0) return error; - msi_domain = dev_get_msi_domain(dev); - if (!msi_domain) { - error = -EINVAL; - goto cleanup_msi_descs; - } - /* * NOTE: Calling this function will trigger the invocation of the * its_fsl_mc_msi_prepare() callback