Patch "i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path" has been added to the 6.3-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

    i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path

to the 6.3-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:
     i2c-cadence-cdns_i2c_master_xfer-fix-runtime-pm-leak.patch
and it can be found in the queue-6.3 subdirectory.

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



commit 6c5394c1ee735e7a84c231b38e527a99803156cd
Author: Lars-Peter Clausen <lars@xxxxxxxxxx>
Date:   Thu Apr 13 19:10:21 2023 -0700

    i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path
    
    [ Upstream commit ae1664f04f504a998737f5bb563f16b44357bcca ]
    
    The cdns_i2c_master_xfer() function gets a runtime PM reference when the
    function is entered. This reference is released when the function is
    exited. There is currently one error path where the function exits
    directly, which leads to a leak of the runtime PM reference.
    
    Make sure that this error path also releases the runtime PM reference.
    
    Fixes: 1a351b10b967 ("i2c: cadence: Added slave support")
    Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
    Reviewed-by: Michal Simek <michal.simek@xxxxxxx>
    Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b5d22e7282c22..982c207d473b7 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -827,8 +827,10 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
 	/* Check i2c operating mode and switch if possible */
 	if (id->dev_mode == CDNS_I2C_MODE_SLAVE) {
-		if (id->slave_state != CDNS_I2C_SLAVE_STATE_IDLE)
-			return -EAGAIN;
+		if (id->slave_state != CDNS_I2C_SLAVE_STATE_IDLE) {
+			ret = -EAGAIN;
+			goto out;
+		}
 
 		/* Set mode to master */
 		cdns_i2c_set_mode(CDNS_I2C_MODE_MASTER, id);



[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