]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: mdio-mux-gpio: use devm_gpiod_get_array()
authorJisheng Zhang <Jisheng.Zhang@synaptics.com>
Tue, 21 Jul 2020 07:01:57 +0000 (15:01 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 22:35:29 +0000 (15:35 -0700)
Use devm_gpiod_get_array() to simplify the error handling and exit
code path.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio-mux-gpio.c

index 6c8960df43b0fa9762f7fff05d7db45069ffd7b9..10a758fdc9e63de28b0542fc95a71a30bc9f10ac 100644 (file)
@@ -42,25 +42,21 @@ static int mdio_mux_gpio_probe(struct platform_device *pdev)
        struct gpio_descs *gpios;
        int r;
 
-       gpios = gpiod_get_array(&pdev->dev, NULL, GPIOD_OUT_LOW);
+       gpios = devm_gpiod_get_array(&pdev->dev, NULL, GPIOD_OUT_LOW);
        if (IS_ERR(gpios))
                return PTR_ERR(gpios);
 
        s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL);
-       if (!s) {
-               gpiod_put_array(gpios);
+       if (!s)
                return -ENOMEM;
-       }
 
        s->gpios = gpios;
 
        r = mdio_mux_init(&pdev->dev, pdev->dev.of_node,
                          mdio_mux_gpio_switch_fn, &s->mux_handle, s, NULL);
 
-       if (r != 0) {
-               gpiod_put_array(s->gpios);
+       if (r != 0)
                return r;
-       }
 
        pdev->dev.platform_data = s;
        return 0;
@@ -70,7 +66,6 @@ static int mdio_mux_gpio_remove(struct platform_device *pdev)
 {
        struct mdio_mux_gpio_state *s = dev_get_platdata(&pdev->dev);
        mdio_mux_uninit(s->mux_handle);
-       gpiod_put_array(s->gpios);
        return 0;
 }