Skip to content

Commit f72f805

Browse files
tnmyshmathieupoirier
authored andcommitted
mailbox: zynqmp: Fix counts of child nodes
If child mailbox node status is disabled it causes crash in interrupt handler. Fix this by assigning only available child node during driver probe. Fixes: 4981b82 ("mailbox: ZynqMP IPI mailbox controller") Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20230311012407.1292118-2-tanmay.shah@amd.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 408ec1f commit f72f805

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/mailbox/zynqmp-ipi-mailbox.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
634634
struct zynqmp_ipi_mbox *mbox;
635635
int num_mboxes, ret = -EINVAL;
636636

637-
num_mboxes = of_get_child_count(np);
637+
num_mboxes = of_get_available_child_count(np);
638+
if (num_mboxes == 0) {
639+
dev_err(dev, "mailbox nodes not available\n");
640+
return -EINVAL;
641+
}
642+
638643
pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes),
639644
GFP_KERNEL);
640645
if (!pdata)

0 commit comments

Comments
 (0)