media: i2c: ds90ub960: Delete duplicate source code in ub960_parse_dt_rxports()
Subsystems (3)
PATCH 1/1 media: i2c: ds90ub960: Delete duplicate source code in ub960_parse_dt_rxports()
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100
Avoid the specification of a duplicate fwnode_handle_put() call in this function implementation.
--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/i2c/ds90ub960.c +1 -4
@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } } -fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ; err_put_links:fwnode_handle_put (links_fwnode);
--
2.44.0
Hi Markus,
Quoted 16 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100Avoid the specification of a duplicate
fwnode_handle_put()call in this function implementation.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/media/i2c/ds90ub960.c +0
-0
drivers/media/i2c/ds90ub960.c static int ub960_parse_dt_rxports(struct ub960_data *priv) · line 3489
Quoted 8 lines
drivers/media/i2c/ds90ub960.c +1
-4@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } } -fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ;
I think it'd be nicer to initialise ret as zero, then you can just drop the assignment above.
Quoted 3 lines
drivers/media/i2c/ds90ub960.c +0
-0err_put_links:fwnode_handle_put (links_fwnode);
Signature · 3 lines
Regards, Sakari Ailus
Tomi Valkeinen
maintainerHi,
Quoted 22 lines · Sakari Ailus
Hi Markus,
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100Avoid the specification of a duplicate
fwnode_handle_put()call in this function implementation.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/media/i2c/ds90ub960.c +0
-0@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } }
Quoted 8 lines
drivers/media/i2c/ds90ub960.c static int ub960_parse_dt_rxports(struct ub960_data *priv) · line 3489
Quoted 5 lines
drivers/media/i2c/ds90ub960.c +1
-4-fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ;I think it'd be nicer to initialise ret as zero, then you can just drop the assignment above.
I don't like successful execution entering error paths. That's why there's the return 0.
Tomi
Quoted 4 lines
Quoted 3 lines
drivers/media/i2c/ds90ub960.c +0
-0err_put_links:fwnode_handle_put (links_fwnode);
Huomenta,
Quoted 34 lines · Tomi Valkeinen
Hi,
Quoted 22 lines · Sakari Ailus
Hi Markus,
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100Avoid the specification of a duplicate
fwnode_handle_put()call in this function implementation.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/media/i2c/ds90ub960.c +0
-0@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } }Quoted 8 lines
drivers/media/i2c/ds90ub960.c static int ub960_parse_dt_rxports(struct ub960_data *priv) · line 3489
Quoted 5 lines
drivers/media/i2c/ds90ub960.c +1
-4-fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ;I think it'd be nicer to initialise ret as zero, then you can just drop the assignment above.
Quoted 2 lines
I don't like successful execution entering error paths. That's why there's the return 0.
It could be called a common cleanup path as what you really want to do here is to put the fwnode handle, independently of whether there was an error. I think the current code is of course fine, too.
Soon you can do
struct fwnode_handle *links_fwnode __free(fwnode_handle);
and forget about putting it (but you must need putting it).
Signature · 3 lines
Terveisin, Sakari Ailus
Quoted 22 lines · Sakari Ailus
Quoted 21 lines · Tomi Valkeinen
Quoted 20 lines · Sakari Ailus
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100Avoid the specification of a duplicate
fwnode_handle_put()call in this function implementation.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/media/i2c/ds90ub960.c +0
-0@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } }
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/media/i2c/ds90ub960.c static int ub960_parse_dt_rxports(struct ub960_data *priv) · line 3489
Quoted 5 lines
drivers/media/i2c/ds90ub960.c +1
-4-fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ;I think it'd be nicer to initialise ret as zero, then you can just drop the assignment above.
I think tearing apart the assignment and its actual user is not good.
Quoted 7 lines
Quoted 2 lines
I don't like successful execution entering error paths. That's why there's the return 0.
It could be called a common cleanup path as what you really want to do here is to put the fwnode handle, independently of whether there was an error. I think the current code is of course fine, too.
Quoted 5 lines
Soon you can do
struct fwnode_handle *links_fwnode __free(fwnode_handle);and forget about putting it (but you must need putting it).
Let's wait for the Jonathan's patches to land (v6.9-rc1 I hope) and then we may modify drivers if needed.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 41 lines · Andy Shevchenko
Quoted 22 lines · Sakari Ailus
Quoted 21 lines · Tomi Valkeinen
Quoted 20 lines · Sakari Ailus
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 1 Mar 2024 08:23:24 +0100Avoid the specification of a duplicate
fwnode_handle_put()call in this function implementation.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/i2c/ds90ub960.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/media/i2c/ds90ub960.c +0
-0@@ -3486,10 +3486,7 @@ static int ub960_parse_dt_rxports(struct ub960_data *priv) } }Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/media/i2c/ds90ub960.c static int ub960_parse_dt_rxports(struct ub960_data *priv) · line 3489
Quoted 5 lines
drivers/media/i2c/ds90ub960.c +1
-4-fwnode_handle_put (links_fwnode); - -return 0 ; - + ret =0 ;I think it'd be nicer to initialise ret as zero, then you can just drop the assignment above.
I think tearing apart the assignment and its actual user is not good.
Quoted 7 lines
Quoted 2 lines
I don't like successful execution entering error paths. That's why there's the return 0.
It could be called a common cleanup path as what you really want to do here is to put the fwnode handle, independently of whether there was an error. I think the current code is of course fine, too.
Quoted 8 lines
Quoted 5 lines
Soon you can do
struct fwnode_handle *links_fwnode __free(fwnode_handle);and forget about putting it (but you must need putting it).
Let's wait for the Jonathan's patches to land (v6.9-rc1 I hope) and then we may modify drivers if needed.
The __free(fwnode_handle) stuff has already been merged.
We could do some additional work to make a _scoped() macro for fwnode_handles but here it's function wide so we already have what we need.
regards,
dan carpenter
Quoted 1 line
The
__free(fwnode_handle)stuff has already been merged.
Would you like to point a corresponding commit out?
Regards,
Markus