On 10/31/2017 04:12 AM, Andy Shevchenko wrote:
Instead of mangling this function wouldn't be better to introduce a separate one for line and perhaps a third one which calls them both?
The diff is convoluted, but the end result is clean: static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip) { if (gpiochip->irq_need_valid_mask) { gpiochip->irq_valid_mask = kcalloc(BITS_TO_LONGS(gpiochip->ngpio), sizeof(long), GFP_KERNEL); if (!gpiochip->irq_valid_mask) return -ENOMEM; /* Assume by default all GPIOs are valid */ bitmap_fill(gpiochip->irq_valid_mask, gpiochip->ngpio); } if (gpiochip->line_need_valid_mask) { gpiochip->line_valid_mask = kcalloc(BITS_TO_LONGS(gpiochip->ngpio), sizeof(long), GFP_KERNEL); if (!gpiochip->line_valid_mask) return -ENOMEM; /* Assume by default all GPIOs are valid */ bitmap_fill(gpiochip->line_valid_mask, gpiochip->ngpio); } return 0; } Is this acceptable? -- Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html