mtd: parsers: ofpart: Use common of_node_put() code in bcm4908_partitions_fw_offset()
Subsystems (2)
PATCH 1/1 mtd: parsers: ofpart: Use common of_node_put() code in bcm4908_partitions_fw_offset()
From: Markus Elfring <[email protected]>
Date: Fri, 4 Oct 2024 16:30:52 +0200
Enlarge the scope for the local variable “err” and add a label so that a bit of exception handling can be better reused at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/mtd/parsers/ofpart_bcm4908.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mtd/parsers/ofpart_bcm4908.c +5 -4
@@ -19,6 +19,7 @@ static long long bcm4908_partitions_fw_offset(void)struct device_node *root;struct property *prop;const char *s; +int err; root =of_find_node_by_path ("/" );if (!root)
@@ -27,7 +28,6 @@ static long long bcm4908_partitions_fw_offset(void)of_property_for_each_string (root,"brcm_blparms" , prop, s) {size_t len =strlen (BLPARAMS_FW_OFFSET );unsigned long offset; -int err;if (strncmp (s,BLPARAMS_FW_OFFSET , len) || s[len] !='=' )continue ;
@@ -35,16 +35,17 @@ static long long bcm4908_partitions_fw_offset(void) err =kstrtoul (s + len +1 ,0 , &offset);if (err) {pr_err ("failed to parse %s\n" , s + len +1 ); -of_node_put (root); -return err; + goto put_node; }of_node_put (root);return offset <<10 ; } + err = -ENOENT ; +put_node:of_node_put (root); -return -ENOENT ; +return err; }int bcm4908_partitions_post_parse (struct mtd_info *mtd,struct mtd_partition *parts,int nr_parts)
--
2.46.1