[PATCH 15/17] media: i2c: adp1653: introduce 'no_child' label

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

 



The code mixed gotos and returns, which confused smatch. Add a no_child
label before the 'return -EINVAL;' to help smatch understand this.
It's a bit more consistent as well.

This fixes this smatch warning:

adp1653.c:444 adp1653_of_init() warn: missing unwind goto?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/i2c/adp1653.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index a61a77de6eee..136bca801db7 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -420,7 +420,7 @@ static int adp1653_of_init(struct i2c_client *client,
 
 	child = of_get_child_by_name(node, "flash");
 	if (!child)
-		return -EINVAL;
+		goto no_child;
 
 	if (of_property_read_u32(child, "flash-timeout-us",
 				 &pd->max_flash_timeout))
@@ -441,7 +441,7 @@ static int adp1653_of_init(struct i2c_client *client,
 
 	child = of_get_child_by_name(node, "indicator");
 	if (!child)
-		return -EINVAL;
+		goto no_child;
 
 	if (of_property_read_u32(child, "led-max-microamp",
 				 &pd->max_indicator_intensity))
@@ -459,6 +459,7 @@ static int adp1653_of_init(struct i2c_client *client,
 err:
 	dev_err(&client->dev, "Required property not found\n");
 	of_node_put(child);
+no_child:
 	return -EINVAL;
 }
 
-- 
2.39.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux