summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-09-16 01:30:25 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-09-16 01:30:25 +0000
commitde543cd44333d361d40eafb1d490d14a6deee4ad (patch)
tree94c1744da3ce6fa0bc7836aabe5151c40d95a657 /sys
parent02615ca7e3f0875866ab3926f12fdcb300b2e958 (diff)
MALLOC/FREE -> malloc/free, M_ZERO, extraneous casts,
extraneous #include <malloc.h>
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c28
-rw-r--r--sys/scsi/ch.c6
-rw-r--r--sys/scsi/safte.c4
-rw-r--r--sys/scsi/scsi_base.c3
-rw-r--r--sys/scsi/scsi_ioctl.c4
-rw-r--r--sys/scsi/ses.c8
-rw-r--r--sys/scsi/ss.c3
-rw-r--r--sys/scsi/ss_mustek.c3
-rw-r--r--sys/scsi/ss_scanjet.c3
9 files changed, 26 insertions, 36 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 9c3ad8448ea..36be20ef114 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.133 2007/09/07 16:15:48 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.134 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -930,22 +930,20 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
int len = te->data_len;
int ntracks;
- MALLOC(toc, struct cd_toc *, sizeof(struct cd_toc), M_TEMP,
- M_WAITOK);
- bzero(toc, sizeof(*toc));
+ toc = malloc(sizeof(*toc), M_TEMP, M_WAITOK | M_ZERO);
th = &toc->header;
if (len > sizeof(toc->entries) ||
len < sizeof(struct cd_toc_entry)) {
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
error = EINVAL;
break;
}
error = cd_read_toc(cd, te->address_format, te->starting_track,
toc, len + sizeof(struct ioc_toc_header), 0);
if (error) {
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
break;
}
if (te->address_format == CD_LBA_FORMAT)
@@ -970,7 +968,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
sizeof(th->ending_track)));
error = copyout(toc->entries, te->data, len);
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
break;
}
case CDIOREADMSADDR: {
@@ -983,16 +981,14 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
break;
}
- MALLOC(toc, struct cd_toc *, sizeof(struct cd_toc), M_TEMP,
- M_WAITOK);
- bzero(toc, sizeof(*toc));
+ toc = malloc(sizeof(*toc), M_TEMP, M_WAITOK | M_ZERO);
error = cd_read_toc(cd, 0, 0, toc,
sizeof(struct ioc_toc_header) + sizeof(struct cd_toc_entry),
0x40 /* control word for "get MS info" */);
if (error) {
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
break;
}
@@ -1011,7 +1007,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
*(int *)addr = (toc->header.len >= 10 && cte->track > 1) ?
cte->addr.lba : 0;
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
break;
}
case CDIOCSETPATCH: {
@@ -1157,8 +1153,7 @@ cdgetdisklabel(dev_t dev, struct cd_softc *cd, struct disklabel *lp,
bzero(lp, sizeof(struct disklabel));
- MALLOC(toc, struct cd_toc *, sizeof(struct cd_toc), M_TEMP, M_WAITOK);
- bzero(toc, sizeof(*toc));
+ toc = malloc(sizeof(*toc), M_TEMP, M_WAITOK | M_ZERO);
lp->d_secsize = cd->params.blksize;
lp->d_ntracks = 1;
@@ -1460,8 +1455,7 @@ cd_play_tracks(struct cd_softc *cd, int strack, int sindex, int etrack,
if (strack > etrack)
return (EINVAL);
- MALLOC(toc, struct cd_toc *, sizeof(struct cd_toc), M_TEMP, M_WAITOK);
- bzero(toc, sizeof(*toc));
+ toc = malloc(sizeof(*toc), M_TEMP, M_WAITOK | M_ZERO);
if ((error = cd_load_toc(cd, toc, CD_MSF_FORMAT)) != 0)
goto done;
@@ -1500,7 +1494,7 @@ cd_play_tracks(struct cd_softc *cd, int strack, int sindex, int etrack,
endm, ends, endf);
done:
- FREE(toc, M_TEMP);
+ free(toc, M_TEMP);
return (error);
}
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index f9e43684ecb..1fc1fa1a712 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ch.c,v 1.33 2007/09/07 16:15:49 krw Exp $ */
+/* $OpenBSD: ch.c,v 1.34 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
@@ -566,7 +566,7 @@ ch_usergetelemstatus(sc, cesr)
* we can allocate enough storage for all of them. We assume
* that the first one can fit into 1k.
*/
- data = (caddr_t)malloc(1024, M_DEVBUF, M_WAITOK);
+ data = malloc(1024, M_DEVBUF, M_WAITOK);
error = ch_getelemstatus(sc, sc->sc_firsts[chet], 1, data, 1024,
want_voltags);
if (error)
@@ -586,7 +586,7 @@ ch_usergetelemstatus(sc, cesr)
* device.
*/
free(data, M_DEVBUF);
- data = (caddr_t)malloc(size, M_DEVBUF, M_WAITOK);
+ data = malloc(size, M_DEVBUF, M_WAITOK);
error = ch_getelemstatus(sc, sc->sc_firsts[chet],
sc->sc_counts[chet], data, size, want_voltags);
if (error)
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c
index 6b77c78732c..7498abadce4 100644
--- a/sys/scsi/safte.c
+++ b/sys/scsi/safte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safte.c,v 1.38 2007/09/07 16:15:49 krw Exp $ */
+/* $OpenBSD: safte.c,v 1.39 2007/09/16 01:30:24 krw Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -559,7 +559,7 @@ safte_bio_blink(struct safte_softc *sc, struct bioc_blink *blink)
if (slot >= sc->sc_nslots)
return (ENODEV);
- op = malloc(sizeof(struct safte_slotop), M_TEMP, M_ZERO);
+ op = malloc(sizeof(*op), M_TEMP, M_ZERO);
op->opcode = SAFTE_WRITE_SLOTOP;
op->slot = slot;
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 92b5db1f9e0..d4355114148 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.122 2007/06/23 19:19:49 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.123 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -41,7 +41,6 @@
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/uio.h>
-#include <sys/malloc.h>
#include <sys/errno.h>
#include <sys/device.h>
#include <sys/proc.h>
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index a82c99231bd..cfea976dea6 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.29 2007/09/07 16:15:49 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.30 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -115,7 +115,7 @@ si_get(void)
struct scsi_ioctl *si;
int s;
- si = malloc(sizeof(struct scsi_ioctl), M_TEMP, M_WAITOK | M_ZERO);
+ si = malloc(sizeof(*si), M_TEMP, M_WAITOK | M_ZERO);
s = splbio();
LIST_INSERT_HEAD(&si_head, si, si_list);
splx(s);
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 7871355e5dd..e8d6992d083 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.46 2007/09/07 16:15:49 krw Exp $ */
+/* $OpenBSD: ses.c,v 1.47 2007/09/16 01:30:24 krw Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -426,8 +426,8 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
switch (types[i].type) {
#if NBIO > 0
case SES_T_DEVICE:
- slot = malloc(sizeof(struct ses_slot),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ slot = malloc(sizeof(*slot), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (slot == NULL)
goto error;
@@ -458,7 +458,7 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
continue;
}
- sensor = malloc(sizeof(struct ses_sensor), M_DEVBUF,
+ sensor = malloc(sizeof(*sensor), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (sensor == NULL)
goto error;
diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c
index aae87891719..7e77a020bda 100644
--- a/sys/scsi/ss.c
+++ b/sys/scsi/ss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss.c,v 1.58 2006/12/21 02:05:46 krw Exp $ */
+/* $OpenBSD: ss.c,v 1.59 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */
/*
@@ -36,7 +36,6 @@
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
-#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/user.h>
diff --git a/sys/scsi/ss_mustek.c b/sys/scsi/ss_mustek.c
index c0201312a38..a20153c606b 100644
--- a/sys/scsi/ss_mustek.c
+++ b/sys/scsi/ss_mustek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_mustek.c,v 1.14 2006/11/28 16:56:50 dlg Exp $ */
+/* $OpenBSD: ss_mustek.c,v 1.15 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: ss_mustek.c,v 1.4 1996/05/05 19:52:57 christos Exp $ */
/*
@@ -53,7 +53,6 @@
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
-#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/user.h>
diff --git a/sys/scsi/ss_scanjet.c b/sys/scsi/ss_scanjet.c
index 18c8a3a6f96..1b9e9753cec 100644
--- a/sys/scsi/ss_scanjet.c
+++ b/sys/scsi/ss_scanjet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_scanjet.c,v 1.31 2007/06/01 20:59:04 moritz Exp $ */
+/* $OpenBSD: ss_scanjet.c,v 1.32 2007/09/16 01:30:24 krw Exp $ */
/* $NetBSD: ss_scanjet.c,v 1.6 1996/05/18 22:58:01 christos Exp $ */
/*
@@ -40,7 +40,6 @@
#include <sys/fcntl.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
-#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/user.h>