Use devm_* API to simplify driver code.---
Signed-off-by: Peng Fan <van.freenix@xxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: Alexandre Courbot <gnurou@xxxxxxxxx>
drivers/gpio/gpiolib.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 6bc612b..f9470b0 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -243,7 +243,8 @@ int gpiochip_add(struct gpio_chip *chip)
int base = chip->base;
struct gpio_desc *descs;
- descs = kcalloc(chip->ngpio, sizeof(descs[0]), GFP_KERNEL);
+ descs = devm_kcalloc(chip->dev, chip->ngpio, sizeof(descs[0]),
+ GFP_KERNEL);