chiark / gitweb /
Remove some dead code
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 Mar 2013 05:38:36 +0000 (01:38 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 31 Mar 2013 18:28:36 +0000 (14:28 -0400)
Based on coverity report.

src/bootchart/svg.c
src/core/dbus.c
src/libudev/libudev-util.c
src/shared/utmp-wtmp.c
src/timedate/timedated.c
src/udev/udevadm-trigger.c

index cd896895c9ba2adf650d60b0d8b91150351be3e1..0fb9fffd9b834e9568900353107ed4f60b5415c7 100644 (file)
@@ -823,9 +823,6 @@ static void svg_ps_bars(void) {
                 double starttime;
                 int t;
 
-                if (!ps)
-                        continue;
-
                 enc_name = xml_comment_encode(ps->name);
                 if(!enc_name)
                         continue;
index 62cbf89f647d41667528d55ae85b3bac0815de58..b92c7d0b99923cc739f7d224fcc3f03fca3bd435 100644 (file)
@@ -978,9 +978,8 @@ static DBusConnection* manager_bus_connect_private(Manager *m, DBusBusType type)
         }
 
         return connection;
+
 fail:
-        if (connection)
-                dbus_connection_close(connection);
         dbus_error_free(&error);
         return NULL;
 }
index 44f6e4a863b1df1f4f2bef99b5fb762fbb327e8c..714dc50ae9609911bbbb3d21c08c942bed8963cf 100644 (file)
@@ -241,8 +241,7 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
                         return -EINVAL;
                 base[0] = '\0';
         }
-        if (base == NULL)
-                return -EINVAL;
+
         strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL);
         return 0;
 }
index 0a0180979b0ae7492a6f2987dafcbecf3583b64d..c9b986fc08480f77696685050a2b5277fcf1539f 100644 (file)
@@ -77,15 +77,11 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
                 a = found->ut_pid & 0xFF;
                 b = (found->ut_pid >> 8) & 0xFF;
 
-                if (a < 0 || b < 0)
-                        r = -EIO;
-                else {
-                        *runlevel = a;
+                *runlevel = a;
+                if (previous)
+                        *previous = b;
 
-                        if (previous)
-                                *previous = b;
-                        r = 0;
-                }
+                r = 0;
         }
 
         endutxent();
index 16fffd08440cade294b4d9681c7fd568f5df44fe..1d4d73911e20362b5674160333a0e797fa8ef5bb 100644 (file)
@@ -367,8 +367,6 @@ static int read_ntp(DBusConnection *bus) {
                         goto finish;
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
                 if (!reply) {
                         if (streq(error.name, "org.freedesktop.DBus.Error.FileNotFound")) {
@@ -450,8 +448,6 @@ static int start_ntp(DBusConnection *bus, DBusError *error) {
                         goto finish;
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, error);
                 if (!reply) {
                         if (streq(error->name, "org.freedesktop.DBus.Error.FileNotFound") ||
@@ -540,8 +536,6 @@ static int enable_ntp(DBusConnection *bus, DBusError *error) {
                         }
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, error);
                 if (!reply) {
                         if (streq(error->name, "org.freedesktop.DBus.Error.FileNotFound")) {
index 9624c66fba9e1a4b3f17cbc6ae50761ac94d6b5f..f472996965ae68e51d911fa3cf14485f0522c342 100644 (file)
@@ -214,7 +214,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
                 exec_list(udev_enumerate, action);
                 goto exit;
         default:
-                goto exit;
+                assert_not_reached("device_type");
         }
 exit:
         udev_enumerate_unref(udev_enumerate);