gpio: max732x: use devm_gpiochip_add_data()
We can simplify the code a bit with a resource managed variant of gpiochip_add_data(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
375b942467
commit
2674700c4c
@ -698,15 +698,13 @@ static int max732x_probe(struct i2c_client *client,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = gpiochip_add_data(&chip->gpio_chip, chip);
|
||||
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = max732x_irq_setup(chip, id);
|
||||
if (ret) {
|
||||
gpiochip_remove(&chip->gpio_chip);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (pdata && pdata->setup) {
|
||||
ret = pdata->setup(client, chip->gpio_chip.base,
|
||||
@ -736,8 +734,6 @@ static int max732x_remove(struct i2c_client *client)
|
||||
}
|
||||
}
|
||||
|
||||
gpiochip_remove(&chip->gpio_chip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user