[PATCH 1/2] mailbox: qcom-ipcc: amend qcom_ipcc_domain_map() to report errors

Gabriele Paoloni posted 2 patches 3 weeks ago
[PATCH 1/2] mailbox: qcom-ipcc: amend qcom_ipcc_domain_map() to report errors
Posted by Gabriele Paoloni 3 weeks ago
Currently qcom_ipcc_domain_map() ignores errors returned by
irq_set_chip_data() and invokes irq_set_chip_and_handler()
that in turn ignores errors returned by irq_set_chip().
This patch fixes both issues; no other functional changes
are implemented.

Signed-off-by: Gabriele Paoloni <gpaoloni@redhat.com>
---
 drivers/mailbox/qcom-ipcc.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index d957d989c0ce..c23efaaa64a1 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -116,12 +116,20 @@ static struct irq_chip qcom_ipcc_irq_chip = {
 static int qcom_ipcc_domain_map(struct irq_domain *d, unsigned int irq,
 				irq_hw_number_t hw)
 {
+	int ret;
 	struct qcom_ipcc *ipcc = d->host_data;
 
-	irq_set_chip_and_handler(irq, &qcom_ipcc_irq_chip, handle_level_irq);
-	irq_set_chip_data(irq, ipcc);
-	irq_set_noprobe(irq);
+	ret = irq_set_chip(irq, &qcom_ipcc_irq_chip);
+	if (ret)
+		return ret;
+
+	irq_set_handler(irq, handle_level_irq);
 
+	ret = irq_set_chip_data(irq, ipcc);
+	if (ret)
+		return ret;
+
+	irq_set_noprobe(irq);
 	return 0;
 }
 
-- 
2.48.1
Re: [PATCH 1/2] mailbox: qcom-ipcc: amend qcom_ipcc_domain_map() to report errors
Posted by Brian Masney 3 weeks ago
On Mon, Mar 16, 2026 at 11:26:17AM +0100, Gabriele Paoloni wrote:
> Currently qcom_ipcc_domain_map() ignores errors returned by
> irq_set_chip_data() and invokes irq_set_chip_and_handler()
> that in turn ignores errors returned by irq_set_chip().
> This patch fixes both issues; no other functional changes
> are implemented.
> 
> Signed-off-by: Gabriele Paoloni <gpaoloni@redhat.com>
> ---
>  drivers/mailbox/qcom-ipcc.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
> index d957d989c0ce..c23efaaa64a1 100644
> --- a/drivers/mailbox/qcom-ipcc.c
> +++ b/drivers/mailbox/qcom-ipcc.c
> @@ -116,12 +116,20 @@ static struct irq_chip qcom_ipcc_irq_chip = {
>  static int qcom_ipcc_domain_map(struct irq_domain *d, unsigned int irq,
>  				irq_hw_number_t hw)
>  {
> +	int ret;
>  	struct qcom_ipcc *ipcc = d->host_data;

Put variables in reverse Christmas tree order.

>  
> -	irq_set_chip_and_handler(irq, &qcom_ipcc_irq_chip, handle_level_irq);

Should irq_set_chip_and_handler() and irq_set_chip_and_handler_name() be
updated to return an int to reduce boiler plate code?

> -	irq_set_chip_data(irq, ipcc);
> -	irq_set_noprobe(irq);
> +	ret = irq_set_chip(irq, &qcom_ipcc_irq_chip);
> +	if (ret)
> +		return ret;
> +
> +	irq_set_handler(irq, handle_level_irq);
>  
> +	ret = irq_set_chip_data(irq, ipcc);
> +	if (ret)
> +		return ret;
> +
> +	irq_set_noprobe(irq);
>  	return 0;

The newline before the return 0 is removed. That should also remove the
irq_set_noprobe() change from the diffstat.

Brian
Re: [PATCH 1/2] mailbox: qcom-ipcc: amend qcom_ipcc_domain_map() to report errors
Posted by Gabriele Paoloni 2 weeks, 3 days ago
On Mon, Mar 16, 2026 at 12:05 PM Brian Masney <bmasney@redhat.com> wrote:
>
> On Mon, Mar 16, 2026 at 11:26:17AM +0100, Gabriele Paoloni wrote:
> > Currently qcom_ipcc_domain_map() ignores errors returned by
> > irq_set_chip_data() and invokes irq_set_chip_and_handler()
> > that in turn ignores errors returned by irq_set_chip().
> > This patch fixes both issues; no other functional changes
> > are implemented.
> >
> > Signed-off-by: Gabriele Paoloni <gpaoloni@redhat.com>
> > ---
> >  drivers/mailbox/qcom-ipcc.c | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
> > index d957d989c0ce..c23efaaa64a1 100644
> > --- a/drivers/mailbox/qcom-ipcc.c
> > +++ b/drivers/mailbox/qcom-ipcc.c
> > @@ -116,12 +116,20 @@ static struct irq_chip qcom_ipcc_irq_chip = {
> >  static int qcom_ipcc_domain_map(struct irq_domain *d, unsigned int irq,
> >                               irq_hw_number_t hw)
> >  {
> > +     int ret;
> >       struct qcom_ipcc *ipcc = d->host_data;
>
> Put variables in reverse Christmas tree order.

Noted, I'll fix in v2.

>
> >
> > -     irq_set_chip_and_handler(irq, &qcom_ipcc_irq_chip, handle_level_irq);
>
> Should irq_set_chip_and_handler() and irq_set_chip_and_handler_name() be
> updated to return an int to reduce boiler plate code?

+TO Thomas Gleixner

It may be a possibility. @Thomas do you have any preference in this regard?

Thanks
Gab

>
> > -     irq_set_chip_data(irq, ipcc);
> > -     irq_set_noprobe(irq);
> > +     ret = irq_set_chip(irq, &qcom_ipcc_irq_chip);
> > +     if (ret)
> > +             return ret;
> > +
> > +     irq_set_handler(irq, handle_level_irq);
> >
> > +     ret = irq_set_chip_data(irq, ipcc);
> > +     if (ret)
> > +             return ret;
> > +
> > +     irq_set_noprobe(irq);
> >       return 0;
>
> The newline before the return 0 is removed. That should also remove the
> irq_set_noprobe() change from the diffstat.
>
> Brian
>