Hi Jonas,

     label = udev_device_get_property_value(device, "OFONO_LABEL");
+    if (!label) {
+        label = udev_device_get_property_value(intf, "OFONO_LABEL");
+    }

Okay, but not really our style.  See doc/coding-style.txt item M1

Hmmm.... I would say that this is essentially the 'variable allocation'
clause of M1.  Set a value; if fail, then do something about it.  Agree?


Yes, but the subsystem assignment on the next line still needs to be separated by an empty line. Also the {} around the if are not needed.



     driver = udev_device_get_property_value(usb_device,
"OFONO_DRIVER");
+    if (!driver) {
+        intf = udev_device_get_parent_with_subsystem_devtype(device,
+                        "usb", "usb_interface");
+        if (intf)
+            driver = udev_device_get_property_value(
+                            intf, "OFONO_DRIVER");
+    }

doc/coding-style.txt item M1

My comment above applies... allocate and handle failure to allocate.

If you declare & assign a variable, we prefer an empty line.  e.g.

if () {
        foo *bar = baz;

        if (bar)
                // do something
}

Also, the original comment was about the two if statements not being separated out. So you have:

if (!driver) {
        ...
}
if (driver == NULL)

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to