diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-09-19 21:07:05 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-09-19 21:07:05 +0000 |
commit | a51fb5acf820805d0e73691dddb28f0985486b84 (patch) | |
tree | a6bd4e2c1992c3e7d897069859779b1a00f502af /sys/arch | |
parent | 770304b5396c370623ba149135a86ee62fefdc3d (diff) |
trivial "if(x) free(x)" replacement by "free(x)"
ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/stand/libsa/biosdev.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.c | 5 | ||||
-rw-r--r-- | sys/arch/loongson/dev/bonito.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/openprom.c | 8 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/l1.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/clock.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/openprom.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc/stand/common/dvma.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/fhc.c | 14 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/sbus.c | 17 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/openprom.c | 8 |
12 files changed, 36 insertions, 63 deletions
diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c index 27b423abaf8..5c8d905ab9c 100644 --- a/sys/arch/amd64/stand/libsa/biosdev.c +++ b/sys/arch/amd64/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.23 2015/09/02 01:52:26 yasuoka Exp $ */ +/* $OpenBSD: biosdev.c,v 1.24 2015/09/19 21:07:04 semarie Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -327,8 +327,7 @@ biosd_io(int rw, bios_diskinfo_t *bd, u_int off, int nsect, void *buf) if (bb != buf && rw == F_READ) bcopy(bb, buf, bbsize); - if (bb1 != NULL) - free(bb1, bbsize); + free(bb1, bbsize); #ifdef BIOS_DEBUG if (debug) { diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index d7fa3745494..8725de1f005 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.90 2015/09/02 04:09:24 yasuoka Exp $ */ +/* $OpenBSD: biosdev.c,v 1.91 2015/09/19 21:07:04 semarie Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -328,8 +328,7 @@ biosd_io(int rw, bios_diskinfo_t *bd, u_int off, int nsect, void *buf) if (bb != buf && rw == F_READ) bcopy(bb, buf, bbsize); - if (bb1 != NULL) - free(bb1, bbsize); + free(bb1, bbsize); #ifdef BIOS_DEBUG if (debug) { diff --git a/sys/arch/loongson/dev/bonito.c b/sys/arch/loongson/dev/bonito.c index 0e5fc2212cf..ddeedbf9df6 100644 --- a/sys/arch/loongson/dev/bonito.c +++ b/sys/arch/loongson/dev/bonito.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bonito.c,v 1.29 2015/09/08 08:33:26 deraadt Exp $ */ +/* $OpenBSD: bonito.c,v 1.30 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: bonito_mainbus.c,v 1.11 2008/04/28 20:23:10 martin Exp $ */ /* $NetBSD: bonito_pci.c,v 1.5 2008/04/28 20:23:28 martin Exp $ */ @@ -1203,8 +1203,7 @@ bonito_get_resource_extent(pci_chipset_tag_t pc, int io) #endif out: - if (exname != NULL) - free(exname, M_DEVBUF, exnamesz); + free(exname, M_DEVBUF, exnamesz); return ex; } diff --git a/sys/arch/macppc/macppc/openprom.c b/sys/arch/macppc/macppc/openprom.c index e661733e39c..78e53be2fd5 100644 --- a/sys/arch/macppc/macppc/openprom.c +++ b/sys/arch/macppc/macppc/openprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openprom.c,v 1.3 2014/07/12 18:44:42 tedu Exp $ */ +/* $OpenBSD: openprom.c,v 1.4 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: openprom.c,v 1.4 2002/01/10 06:21:53 briggs Exp $ */ /* @@ -255,10 +255,8 @@ openpromioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (ENOTTY); } - if (name) - free(name, M_TEMP, 0); - if (value) - free(value, M_TEMP, 0); + free(name, M_TEMP, 0); + free(value, M_TEMP, 0); return (error); } diff --git a/sys/arch/sgi/sgi/l1.c b/sys/arch/sgi/sgi/l1.c index 8c46a70109f..b5e39cc3a0b 100644 --- a/sys/arch/sgi/sgi/l1.c +++ b/sys/arch/sgi/sgi/l1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: l1.c,v 1.10 2015/09/08 10:21:50 deraadt Exp $ */ +/* $OpenBSD: l1.c,v 1.11 2015/09/19 21:07:04 semarie Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -770,8 +770,7 @@ l1_read_board_ia(int16_t nasid, int type, u_char **ria, size_t *rialen) return 0; fail: - if (ia != NULL) - free(ia, M_DEVBUF, ialen); + free(ia, M_DEVBUF, ialen); return rc; } @@ -1187,8 +1186,7 @@ l1_get_brick_spd_record(int16_t nasid, int dimm, u_char **rspd, size_t *rspdlen) return 0; fail: - if (spd != NULL) - free(spd, M_DEVBUF, spdlen); + free(spd, M_DEVBUF, spdlen); return rc; } diff --git a/sys/arch/sparc/sparc/clock.c b/sys/arch/sparc/sparc/clock.c index cd44fee9d98..7fa101c7b01 100644 --- a/sys/arch/sparc/sparc/clock.c +++ b/sys/arch/sparc/sparc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.32 2015/02/10 22:49:16 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.33 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: clock.c,v 1.52 1997/05/24 20:16:05 pk Exp $ */ /* @@ -1125,8 +1125,7 @@ eeprom_uio(uio) error = eeprom_update(buf, (size_t)off, cnt); out: - if (buf) - free(buf, M_DEVBUF, 0); + free(buf, M_DEVBUF, EEPROM_SIZE); eeprom_give(); return (error); #else /* ! SUN4 */ diff --git a/sys/arch/sparc/sparc/openprom.c b/sys/arch/sparc/sparc/openprom.c index 7f55c20303d..6c93b795019 100644 --- a/sys/arch/sparc/sparc/openprom.c +++ b/sys/arch/sparc/sparc/openprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openprom.c,v 1.6 2014/07/12 18:44:43 tedu Exp $ */ +/* $OpenBSD: openprom.c,v 1.7 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: openprom.c,v 1.8 1996/03/31 23:45:34 pk Exp $ */ /* @@ -245,10 +245,8 @@ openpromioctl(dev, cmd, data, flags, p) return (ENOTTY); } - if (name) - free(name, M_TEMP, 0); - if (value) - free(value, M_TEMP, 0); + free(name, M_TEMP, 0); + free(value, M_TEMP, 0); return (error); } diff --git a/sys/arch/sparc/stand/common/dvma.c b/sys/arch/sparc/stand/common/dvma.c index bcdb33f944a..f7995abfc46 100644 --- a/sys/arch/sparc/stand/common/dvma.c +++ b/sys/arch/sparc/stand/common/dvma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvma.c,v 1.7 2014/07/12 21:03:38 tedu Exp $ */ +/* $OpenBSD: dvma.c,v 1.8 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: dvma.c,v 1.2 1995/09/17 00:50:56 pk Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -142,6 +142,5 @@ dvma_free(char *dvma, int len) char *mem; mem = dvma_mapout(dvma, len); - if (mem) - free(mem, len); + free(mem, len); } diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 0b75c88c3fb..3912292a33e 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc.c,v 1.19 2014/07/12 18:44:43 tedu Exp $ */ +/* $OpenBSD: fhc.c,v 1.20 2015/09/19 21:07:04 semarie Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -117,14 +117,10 @@ fhc_attach(struct fhc_softc *sc) (void)config_found(&sc->sc_dv, (void *)&fa, fhc_print); - if (fa.fa_name != NULL) - free(fa.fa_name, M_DEVBUF, 0); - if (fa.fa_reg != NULL) - free(fa.fa_reg, M_DEVBUF, 0); - if (fa.fa_intr != NULL) - free(fa.fa_intr, M_DEVBUF, 0); - if (fa.fa_promvaddrs != NULL) - free(fa.fa_promvaddrs, M_DEVBUF, 0); + free(fa.fa_name, M_DEVBUF, 0); + free(fa.fa_reg, M_DEVBUF, 0); + free(fa.fa_intr, M_DEVBUF, 0); + free(fa.fa_promvaddrs, M_DEVBUF, 0); } sc->sc_blink.bl_func = fhc_led_blink; diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 098e85381a3..7676fc0c0d4 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.43 2014/12/09 06:58:29 doug Exp $ */ +/* $OpenBSD: sbus.c,v 1.44 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -485,17 +485,10 @@ sbus_setup_attach_args(struct sbus_softc *sc, bus_space_tag_t bustag, void sbus_destroy_attach_args(struct sbus_attach_args *sa) { - if (sa->sa_name != NULL) - free(sa->sa_name, M_DEVBUF, 0); - - if (sa->sa_nreg != 0) - free(sa->sa_reg, M_DEVBUF, 0); - - if (sa->sa_intr) - free(sa->sa_intr, M_DEVBUF, 0); - - if (sa->sa_promvaddrs) - free((void *)sa->sa_promvaddrs, M_DEVBUF, 0); + free(sa->sa_name, M_DEVBUF, 0); + free(sa->sa_reg, M_DEVBUF, 0); + free(sa->sa_intr, M_DEVBUF, 0); + free((void *)sa->sa_promvaddrs, M_DEVBUF, 0); bzero(sa, sizeof(struct sbus_attach_args)); /*DEBUG*/ } diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 2a1a7b020e9..43ae1518e04 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.123 2014/11/30 22:26:14 kettenis Exp $ */ +/* $OpenBSD: autoconf.c,v 1.124 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -1077,8 +1077,7 @@ extern bus_space_tag_t mainbus_space_tag; &ma.ma_naddress, (void **)&ma.ma_address); if (rv != 0 && rv != ENOENT) { free(ma.ma_reg, M_DEVBUF, 0); - if (ma.ma_ninterrupts) - free(ma.ma_interrupts, M_DEVBUF, 0); + free(ma.ma_interrupts, M_DEVBUF, 0); continue; } #ifdef DEBUG @@ -1092,10 +1091,8 @@ extern bus_space_tag_t mainbus_space_tag; #endif config_found(dev, &ma, mbprint); free(ma.ma_reg, M_DEVBUF, 0); - if (ma.ma_ninterrupts) - free(ma.ma_interrupts, M_DEVBUF, 0); - if (ma.ma_naddress) - free(ma.ma_address, M_DEVBUF, 0); + free(ma.ma_interrupts, M_DEVBUF, 0); + free(ma.ma_address, M_DEVBUF, 0); } extern int prom_cngetc(dev_t); diff --git a/sys/arch/sparc64/sparc64/openprom.c b/sys/arch/sparc64/sparc64/openprom.c index 33c022f5ab3..b012b364c1e 100644 --- a/sys/arch/sparc64/sparc64/openprom.c +++ b/sys/arch/sparc64/sparc64/openprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openprom.c,v 1.20 2015/02/11 01:14:06 miod Exp $ */ +/* $OpenBSD: openprom.c,v 1.21 2015/09/19 21:07:04 semarie Exp $ */ /* $NetBSD: openprom.c,v 1.4 2002/01/10 06:21:53 briggs Exp $ */ /* @@ -309,10 +309,8 @@ openpromioctl(dev, cmd, data, flags, p) return (ENOTTY); } - if (name) - free(name, M_TEMP, 0); - if (value) - free(value, M_TEMP, 0); + free(name, M_TEMP, 0); + free(value, M_TEMP, 0); return (error); } |