[Mesa-dev] [PATCH] loader: Add missing \n on message printing

Emil Velikov emil.l.velikov at gmail.com
Mon Jan 27 04:53:32 PST 2014


Cover both loader and glx/dri_glx
Drop \n from the default loader logger

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

Hi Eric
The missing \n was inherited from the dri3_common.c which
on itself seems to have come from from the legacy dri_glx.c
codebase.

This patch should cover all the leftout cases.
Feel free to pick this patch if you're happy with it.

Emil

 src/glx/dri_glx.c   |  8 ++++----
 src/loader/loader.c | 23 +++++++++++------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 2e00bf0..03ecc5b 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -418,7 +418,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
                              &framebuffer.size, &framebuffer.stride,
                              &framebuffer.dev_priv_size,
                              &framebuffer.dev_priv)) {
-      ErrorMessageF("XF86DRIGetDeviceInfo failed");
+      ErrorMessageF("XF86DRIGetDeviceInfo failed\n");
       goto handle_error;
    }
 
@@ -429,7 +429,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
    status = drmMap(fd, hFB, framebuffer.size,
                    (drmAddressPtr) & framebuffer.base);
    if (status != 0) {
-      ErrorMessageF("drmMap of framebuffer failed (%s)", strerror(-status));
+      ErrorMessageF("drmMap of framebuffer failed (%s)\n", strerror(-status));
       goto handle_error;
    }
 
@@ -438,7 +438,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
     */
    status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
    if (status != 0) {
-      ErrorMessageF("drmMap of SAREA failed (%s)", strerror(-status));
+      ErrorMessageF("drmMap of SAREA failed (%s)\n", strerror(-status));
       goto handle_error;
    }
 
@@ -453,7 +453,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
                                           &driver_configs, psc);
 
    if (psp == NULL) {
-      ErrorMessageF("Calling driver entry point failed");
+      ErrorMessageF("Calling driver entry point failed\n");
       goto handle_error;
    }
 
diff --git a/src/loader/loader.c b/src/loader/loader.c
index a5bd769..ceee6b7 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -83,7 +83,6 @@ static void default_logger(int level, const char *fmt, ...)
       va_start(args, fmt);
       vfprintf(stderr, fmt, args);
       va_end(args);
-      fprintf(stderr, "\n");
    }
 }
 
@@ -99,14 +98,14 @@ udev_device_new_from_fd(struct udev *udev, int fd)
    struct stat buf;
 
    if (fstat(fd, &buf) < 0) {
-      log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d", fd);
+      log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d\n", fd);
       return NULL;
    }
 
    device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
    if (device == NULL) {
       log_(_LOADER_WARNING,
-              "MESA-LOADER: could not create udev device for fd %d", fd);
+              "MESA-LOADER: could not create udev device for fd %d\n", fd);
       return NULL;
    }
 
@@ -129,14 +128,14 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
 
    parent = udev_device_get_parent(device);
    if (parent == NULL) {
-      log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device");
+      log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device\n");
       goto out;
    }
 
    pci_id = udev_device_get_property_value(parent, "PCI_ID");
    if (pci_id == NULL ||
        sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) {
-      log_(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID");
+      log_(_LOADER_WARNING, "MESA-LOADER: malformed or no PCI ID\n");
       *chip_id = -1;
       goto out;
    }
@@ -166,11 +165,11 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
 
    version = drmGetVersion(fd);
    if (!version) {
-      log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd");
+      log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd\n");
       return FALSE;
    }
    if (!version->name) {
-      log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name");
+      log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name\n");
       drmFreeVersion(version);
       return FALSE;
    }
@@ -186,7 +185,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
       gp.value = chip_id;
       ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
       if (ret) {
-         log_(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915");
+         log_(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915\n");
 	 *chip_id = -1;
       }
    }
@@ -201,7 +200,7 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
       info.value = (unsigned long) chip_id;
       ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
       if (ret) {
-         log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon");
+         log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon\n");
 	 *chip_id = -1;
       }
    }
@@ -274,12 +273,12 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
       drmVersionPtr version = drmGetVersion(fd);
 
       if (!version) {
-         log_(_LOADER_WARNING, "failed to get driver name for fd %d", fd);
+         log_(_LOADER_WARNING, "failed to get driver name for fd %d\n", fd);
          return NULL;
       }
 
       driver = strndup(version->name, version->name_len);
-      log_(_LOADER_INFO, "using driver %s for %d", driver, fd);
+      log_(_LOADER_INFO, "using driver %s for %d\n", driver, fd);
 
       drmFreeVersion(version);
 #endif
@@ -308,7 +307,7 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
 
 out:
    log_(driver ? _LOADER_INFO : _LOADER_WARNING,
-         "pci id for fd %d: %04x:%04x, driver %s",
+         "pci id for fd %d: %04x:%04x, driver %s\n",
          fd, vendor_id, chip_id, driver);
    return driver;
 }
-- 
1.8.5.2



More information about the mesa-dev mailing list