On Fri, Mar 08, 2024 at 04:04:53PM +0530, Bhargav Raviprakash wrote:
> @@ -374,11 +518,17 @@ static int tps6594_request_reg_irqs(struct platform_device *pdev,
> {
> struct tps6594_regulator_irq_type *irq_type;
> struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent);
> - int j;
> + size_t j;
> int irq;
> int error;
> + size_t interrupt_cnt;
> +
> + if (tps->chip_id == TPS6594)
> + interrupt_cnt = ARRAY_SIZE(tps6594_buck1_irq_types);
> + else
> + interrupt_cnt = ARRAY_SIZE(tps65224_buck1_irq_types);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> - for (j = 0; j < REGS_INT_NB; j++) {
> + for (j = 0; j < interrupt_cnt; j++) {
> irq_type = &tps6594_regs_irq_types[j];
^^^^^^^^^^^^^^^^^^^^^^
> irq = platform_get_irq_byname(pdev, irq_type->irq_name);
> if (irq < 0)
The tps6594_regs_irq_types pointer needs to be renamed or people won't
know it's holding tps65224_ data. Probably the function should be
renamed too.
regards,
dan carpenter
Hello,
On Thu, 14 Mar 2024 16:30:09 +0300, Dan Carpenter wrote:
> On Fri, Mar 08, 2024 at 04:04:53PM +0530, Bhargav Raviprakash wrote:
> > @@ -374,11 +518,17 @@ static int tps6594_request_reg_irqs(struct platform_device *pdev,
> > {
> > struct tps6594_regulator_irq_type *irq_type;
> > struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent);
> > - int j;
> > + size_t j;
> > int irq;
> > int error;
> > + size_t interrupt_cnt;
> > +
> > + if (tps->chip_id == TPS6594)
> > + interrupt_cnt = ARRAY_SIZE(tps6594_buck1_irq_types);
> > + else
> > + interrupt_cnt = ARRAY_SIZE(tps65224_buck1_irq_types);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> >
> > - for (j = 0; j < REGS_INT_NB; j++) {
> > + for (j = 0; j < interrupt_cnt; j++) {
> > irq_type = &tps6594_regs_irq_types[j];
> ^^^^^^^^^^^^^^^^^^^^^^
> > irq = platform_get_irq_byname(pdev, irq_type->irq_name);
> > if (irq < 0)
>
> The tps6594_regs_irq_types pointer needs to be renamed or people won't
> know it's holding tps65224_ data. Probably the function should be
> renamed too.
>
> regards,
> dan carpenter
Thanks for the feedback! The name will be changed in the next version.
Regards,
Bhargav