diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2011-06-17 07:06:48 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2011-06-17 07:06:48 +0000 |
commit | 588580a3636f1d2f89071c40a24811393a93accc (patch) | |
tree | fe14f36309c4c36297658840fbee97ea66114ab6 /sys/dev/pci/drm/drm_drv.c | |
parent | f54f5c33e3808aca4c742c69b64f7a9619f240cb (diff) |
M_WAITOK cleanup of two cases:
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is
pointless (malloc() will panic if it can't allocate) so remove the check
and the call.
2) Allocating with M_WAITOK, checking for NULL, and then gracefully
handling failure to allocate is pointless. Instead also pass M_CANFAIL
so malloc() doesn't panic so we can actually handle it gracefully.
1) was done using Coccinelle.
Input from oga.
ok miod.
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 9eb142ff6b1..18338918e48 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.93 2011/06/02 18:22:00 weerd Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.94 2011/06/17 07:06:47 mk Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org> * Copyright © 2008 Intel Corporation @@ -1566,7 +1566,8 @@ drm_gem_load_uao(bus_dma_tag_t dmat, bus_dmamap_t map, struct uvm_object *uao, * This is really quite ugly, but nothing else would need * bus_dmamap_load_uao() yet. */ - segs = malloc(npages * sizeof(*segs), M_DRM, M_WAITOK | M_ZERO); + segs = malloc(npages * sizeof(*segs), M_DRM, + M_WAITOK | M_CANFAIL | M_ZERO); if (segs == NULL) return (ENOMEM); |