summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/grdev-drm.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-09-23 13:33:53 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-23 20:05:44 +0200
commitce540a24d53e1751a5b69224d5a7f5a59f2de7ad (patch)
tree994109f483d2232e29423e671eed1ae49cf3a04e /src/libsystemd-terminal/grdev-drm.c
parent590889ac53c8557493f491b4259669e54074615d (diff)
Silence some "unchecked return-value" warnings
This adds some log-messages to ioctl() calls where we don't really care for the return value. It isn't strictly necessary to look for those, but lets be sure and print warnings. This silences gcc and coverity, and also makes sure we get reports in case something goes wrong and we didn't expect it to fail that way.
Diffstat (limited to 'src/libsystemd-terminal/grdev-drm.c')
-rw-r--r--src/libsystemd-terminal/grdev-drm.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/libsystemd-terminal/grdev-drm.c b/src/libsystemd-terminal/grdev-drm.c
index 2e55ad326b..5c65c096de 100644
--- a/src/libsystemd-terminal/grdev-drm.c
+++ b/src/libsystemd-terminal/grdev-drm.c
@@ -1474,14 +1474,19 @@ static int grdrm_fb_new(grdrm_fb **out, grdrm_card *card, const struct drm_mode_
grdrm_fb *grdrm_fb_free(grdrm_fb *fb) {
unsigned int i;
+ int r;
if (!fb)
return NULL;
assert(fb->card);
- if (fb->id > 0 && fb->card->fd >= 0)
- ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id);
+ if (fb->id > 0 && fb->card->fd >= 0) {
+ r = ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id);
+ if (r < 0)
+ log_debug("grdrm: %s: cannot delete framebuffer %" PRIu32 ": %m",
+ fb->card->base.name, fb->id);
+ }
for (i = 0; i < ELEMENTSOF(fb->handles); ++i) {
struct drm_mode_destroy_dumb destroy_dumb = { };
@@ -1491,7 +1496,10 @@ grdrm_fb *grdrm_fb_free(grdrm_fb *fb) {
if (fb->handles[i] > 0 && fb->card->fd >= 0) {
destroy_dumb.handle = fb->handles[i];
- ioctl(fb->card->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
+ r = ioctl(fb->card->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
+ if (r < 0)
+ log_debug("grdrm: %s: cannot destroy dumb-buffer %" PRIu32 ": %m",
+ fb->card->base.name, fb->handles[i]);
}
}
@@ -2549,8 +2557,13 @@ static int unmanaged_card_new(grdev_card **out, grdev_session *session, struct u
basecard->session->name, basecard->name, cu->devnode);
} else {
/* We might get DRM-Master implicitly on open(); drop it immediately
- * so we acquire it only once we're actually enabled. */
- ioctl(fd, DRM_IOCTL_DROP_MASTER, 0);
+ * so we acquire it only once we're actually enabled. We don't
+ * really care whether this call fails or not, but lets log any
+ * weird errors, anyway. */
+ r = ioctl(fd, DRM_IOCTL_DROP_MASTER, 0);
+ if (r < 0 && errno != EACCES && errno != EINVAL)
+ log_debug("grdrm: %s/%s: cannot drop DRM-Master: %m",
+ basecard->session->name, basecard->name);
r = grdrm_card_open(&cu->card, fd);
if (r < 0)