[PATCH 1/2] i2c: do not leave semaphore armed when copying properties fails

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

 



We should not leave i2c_register_board_info() early, without unlocking the
__i2c_board_lock.

Fixes: b0c1e95ab44f ("i2c: copy device properties when using ...")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
 drivers/i2c/i2c-boardinfo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index 5b8f6c3a6950..0e285c68b2ff 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -84,8 +84,10 @@ int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsig
 		if (info->properties) {
 			devinfo->board_info.properties =
 					property_entries_dup(info->properties);
-			if (IS_ERR(devinfo->board_info.properties))
-				return PTR_ERR(devinfo->board_info.properties);
+			if (IS_ERR(devinfo->board_info.properties)) {
+				status = PTR_ERR(devinfo->board_info.properties);
+				break;
+			}
 		}
 
 		list_add_tail(&devinfo->list, &__i2c_board_list);
-- 
2.12.0.246.ga2ecc84866-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux