Patch "gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gpio-mpc8xxx-use-devm_gpiochip_add_data-to-simplify-.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4bf380d5b8dec8d7a31773a69de1b2ba77fd053f
Author: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Date:   Fri Aug 20 17:38:13 2021 +0200

    gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak
    
    [ Upstream commit 889a1b3f35db6ba5ba6a0c23a3a55594570b6a17 ]
    
    If an error occurs after a 'gpiochip_add_data()' call it must be undone by
    a corresponding 'gpiochip_remove()' as already done in the remove function.
    
    To simplify the code a fix a leak in the error handling path of the probe,
    use the managed version instead (i.e. 'devm_gpiochip_add_data()')
    
    Fixes: 698b8eeaed72 ("gpio/mpc8xxx: change irq handler from chained to normal")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
    Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index a4983c5d1f16..023b99bf098d 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -374,7 +374,7 @@ static int mpc8xxx_probe(struct platform_device *pdev)
 	    of_device_is_compatible(np, "fsl,ls1088a-gpio"))
 		gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
 
-	ret = gpiochip_add_data(gc, mpc8xxx_gc);
+	ret = devm_gpiochip_add_data(&pdev->dev, gc, mpc8xxx_gc);
 	if (ret) {
 		pr_err("%pOF: GPIO chip registration failed with status %d\n",
 		       np, ret);
@@ -419,8 +419,6 @@ static int mpc8xxx_remove(struct platform_device *pdev)
 		irq_domain_remove(mpc8xxx_gc->irq);
 	}
 
-	gpiochip_remove(&mpc8xxx_gc->gc);
-
 	return 0;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux