instead of:

+       np = client->dev.of_node;
+
+       if (np) {
+               i = of_property_match_string(np, "reg-names", name);
+               if (i >= 0)
+                       of_property_read_u32_index(np, "reg", i, &addr);
+               else if (default_addr != 0)
+                       addr = default_addr;
+               else
+                       addr = NULL;
+       } else {
+               addr = default_addr;
+       }


how about making the middle part like this to remove the repeated code

        np = client->dev.of_node;
        addr = default_addr;

        if (np) {
                i = of_property_match_string(np, "reg-names", name);
                if (i >= 0)
                        of_property_read_u32_index(np, "reg", i, &addr);
                else if (default_addr == 0)
                        addr = NULL;
        }


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

Reply via email to