From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bl2nam02on0103.outbound.protection.outlook.com ([104.47.38.103]:27456 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932835AbeDIAhs (ORCPT ); Sun, 8 Apr 2018 20:37:48 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Suzuki K Poulose , Marc Zyngier , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 102/162] irqchip/gic-v3: Report failures in gic_irq_domain_alloc Date: Mon, 9 Apr 2018 00:29:01 +0000 Message-ID: <20180409002738.163941-102-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Suzuki K Poulose [ Upstream commit 63c16c6eacb69d0cbdaee5dea0dd56d238375fe6 ] If the GIC cannot map an IRQ via irq_domain_ops->alloc(), it doesn't return an error code. This can cause a problem with drivers, where it thinks it has successfully got an IRQ for the device, but requesting the same ends up failure with -ENOSYS (as the IRQ's chip is not set). Fixes: commit 443acc4f37f6 ("irqchip: GICv3: Convert to domain hierarchy") Cc: Marc Zyngier Signed-off-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 3f1c4dea8866..5d93e0254d70 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -802,8 +802,11 @@ static int gic_irq_domain_alloc(struct irq_domain *dom= ain, unsigned int virq, if (ret) return ret; =20 - for (i =3D 0; i < nr_irqs; i++) - gic_irq_domain_map(domain, virq + i, hwirq + i); + for (i =3D 0; i < nr_irqs; i++) { + ret =3D gic_irq_domain_map(domain, virq + i, hwirq + i); + if (ret) + return ret; + } =20 return 0; } --=20 2.15.1