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: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
---
Changes in v5:
- mailbox node count should not be 0 for driver to probe
drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index a4c8d23c76e2..ae47fbac38d2 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
struct zynqmp_ipi_mbox *mbox;
int num_mboxes, ret = -EINVAL;
- num_mboxes = of_get_child_count(np);
+ num_mboxes = of_get_available_child_count(np);
+ if (num_mboxes == 0) {
+ dev_err(dev, "mailbox nodes not available\n");
+ return -EINVAL;
+ }
+
pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes),
GFP_KERNEL);
if (!pdata)
--
2.25.1
On Fri, Mar 10, 2023 at 05:24:04PM -0800, Tanmay Shah wrote: > 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: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller") > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> > --- > > Changes in v5: > - mailbox node count should not be 0 for driver to probe > > drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c > index a4c8d23c76e2..ae47fbac38d2 100644 > --- a/drivers/mailbox/zynqmp-ipi-mailbox.c > +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c > @@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) > struct zynqmp_ipi_mbox *mbox; > int num_mboxes, ret = -EINVAL; > > - num_mboxes = of_get_child_count(np); > + num_mboxes = of_get_available_child_count(np); > + if (num_mboxes == 0) { > + dev_err(dev, "mailbox nodes not available\n"); > + return -EINVAL; > + } > + This patchset looks good now. I'll queue it once I get an ack from Michal. Thanks, Mathieu > pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes), > GFP_KERNEL); > if (!pdata) > -- > 2.25.1 >
On 3/13/23 20:38, Mathieu Poirier wrote: > On Fri, Mar 10, 2023 at 05:24:04PM -0800, Tanmay Shah wrote: >> 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: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller") >> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> >> --- >> >> Changes in v5: >> - mailbox node count should not be 0 for driver to probe >> >> drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c >> index a4c8d23c76e2..ae47fbac38d2 100644 >> --- a/drivers/mailbox/zynqmp-ipi-mailbox.c >> +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c >> @@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) >> struct zynqmp_ipi_mbox *mbox; >> int num_mboxes, ret = -EINVAL; >> >> - num_mboxes = of_get_child_count(np); >> + num_mboxes = of_get_available_child_count(np); >> + if (num_mboxes == 0) { >> + dev_err(dev, "mailbox nodes not available\n"); >> + return -EINVAL; >> + } >> + > > This patchset looks good now. I'll queue it once I get an ack from Michal. Patches 1,2,3 are acked by me already. 4,5 are remoteproc one which I am not testing. If 4,5 are fine please queue them. Thanks, Michal
On 3/11/23 02:24, Tanmay Shah wrote: > 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: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller") > Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> > --- > > Changes in v5: > - mailbox node count should not be 0 for driver to probe > > drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c > index a4c8d23c76e2..ae47fbac38d2 100644 > --- a/drivers/mailbox/zynqmp-ipi-mailbox.c > +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c > @@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) > struct zynqmp_ipi_mbox *mbox; > int num_mboxes, ret = -EINVAL; > > - num_mboxes = of_get_child_count(np); > + num_mboxes = of_get_available_child_count(np); > + if (num_mboxes == 0) { > + dev_err(dev, "mailbox nodes not available\n"); > + return -EINVAL; > + } > + > pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes), > GFP_KERNEL); > if (!pdata) Acked-by: Michal Simek <michal.simek@amd.com> Thanks, Michal
© 2016 - 2025 Red Hat, Inc.