Re: [PATCH v3] gpio: sch311x: Use devm_gpiochip_add_data() to simplify remove path

From: Andrew Davis
Date: Tue May 16 2023 - 11:20:36 EST


On 5/15/23 4:08 PM, Andy Shevchenko wrote:
On Mon, May 15, 2023 at 8:42 PM Andrew Davis <afd@xxxxxx> wrote:

Use devm version of gpiochip add function to handle removal for us.

...version of gpiochip_add() function...

...

+ err = devm_gpiochip_add_data(&pdev->dev, &block->chip, block);
if (err < 0) {
dev_err(&pdev->dev,
"Could not register gpiochip, %d\n", err);
- goto exit_err;
+ return err;

With this applied you can consider a followup to have this be converted to use

return dev_err_probe(...);

here and in other ->probe() related pieces.


Sure, I can add that cleanup to my list.

Or maybe Coccinelle can help do this everywhere, will have to look into that.

Andrew

}