summaryrefslogtreecommitdiffstats
path: root/sys/cam/ctl/ctl_backend_ramdisk.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2012-09-27 10:51:38 +0000
committertrasz <trasz@FreeBSD.org>2012-09-27 10:51:38 +0000
commitcec93f2f0fd32287db02b1dd801bf4b271535e5c (patch)
tree81fc970941fb82a9396e8991d3f4fef7c67f2273 /sys/cam/ctl/ctl_backend_ramdisk.c
parentf6854895af161d1c346ba04f83ff26ab6d15ccbc (diff)
downloadFreeBSD-src-cec93f2f0fd32287db02b1dd801bf4b271535e5c.zip
FreeBSD-src-cec93f2f0fd32287db02b1dd801bf4b271535e5c.tar.gz
Remove useless NULL checks after M_WAITOK allocations.
Diffstat (limited to 'sys/cam/ctl/ctl_backend_ramdisk.c')
-rw-r--r--sys/cam/ctl/ctl_backend_ramdisk.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c
index b1d4502..985fad4 100644
--- a/sys/cam/ctl/ctl_backend_ramdisk.c
+++ b/sys/cam/ctl/ctl_backend_ramdisk.c
@@ -134,7 +134,7 @@ ctl_backend_ramdisk_init(void)
{
struct ctl_be_ramdisk_softc *softc;
#ifdef CTL_RAMDISK_PAGES
- int i, j;
+ int i;
#endif
@@ -151,17 +151,8 @@ ctl_backend_ramdisk_init(void)
softc->ramdisk_pages = (uint8_t **)malloc(sizeof(uint8_t *) *
softc->num_pages, M_RAMDISK,
M_WAITOK);
- for (i = 0; i < softc->num_pages; i++) {
+ for (i = 0; i < softc->num_pages; i++)
softc->ramdisk_pages[i] = malloc(PAGE_SIZE, M_RAMDISK,M_WAITOK);
- if (softc->ramdisk_pages[i] == NULL) {
- for (j = 0; j < i; j++) {
- free(softc->ramdisk_pages[j], M_RAMDISK);
- }
- free(softc->ramdisk_pages, M_RAMDISK);
- panic("RAMDisk initialization failed\n");
- return (1); /* NOTREACHED */
- }
- }
#else
softc->ramdisk_buffer = (uint8_t *)malloc(softc->rd_size, M_RAMDISK,
M_WAITOK);
@@ -313,13 +304,6 @@ ctl_backend_ramdisk_submit(union ctl_io *io)
io->scsiio.kern_data_ptr = malloc(sizeof(struct ctl_sg_entry) *
num_sg_entries, M_RAMDISK,
M_WAITOK);
- if (io->scsiio.kern_data_ptr == NULL) {
- ctl_set_internal_failure(&io->scsiio,
- /*sks_valid*/ 0,
- /*retry_count*/ 0);
- ctl_done(io);
- return (CTL_RETVAL_COMPLETE);
- }
sg_entries = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr;
for (i = 0, len_filled = 0; i < num_sg_entries;
i++, len_filled += PAGE_SIZE) {
OpenPOWER on IntegriCloud