diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-27 05:48:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-27 05:48:41 +0000 |
commit | aaa8e6ebc0345b98bc04f258a2e921c4ce28646f (patch) | |
tree | 8bb8b0e40d6a27a93d1299bc36540a76699492dd /sys/dev | |
parent | 39ce3a4069f9760e27233b2fd828797f928f73e8 (diff) |
simple sizes for free()
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/gpio/gpio.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/gpio/gpio.c b/sys/dev/gpio/gpio.c index 7ccf7346810..05fbd6ed419 100644 --- a/sys/dev/gpio/gpio.c +++ b/sys/dev/gpio/gpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpio.c,v 1.13 2014/07/12 18:48:17 tedu Exp $ */ +/* $OpenBSD: gpio.c,v 1.14 2015/08/27 05:48:40 deraadt Exp $ */ /* * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org> @@ -411,7 +411,7 @@ gpioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) dv = config_found_sm((struct device *)sc, &ga, gpiobus_print, gpio_submatch); if (dv != NULL) { - gdev = malloc(sizeof(struct gpio_dev), M_DEVBUF, + gdev = malloc(sizeof(*gdev), M_DEVBUF, M_WAITOK); gdev->sc_dev = dv; LIST_INSERT_HEAD(&sc->sc_devs, gdev, sc_next); @@ -427,7 +427,7 @@ gpioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) == 0) { if (config_detach(gdev->sc_dev, 0) == 0) { LIST_REMOVE(gdev, sc_next); - free(gdev, M_DEVBUF, 0); + free(gdev, M_DEVBUF, sizeof(*gdev)); } break; } @@ -473,8 +473,7 @@ gpioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; } if (!found) { - nm = malloc(sizeof(struct gpio_name), - M_DEVBUF, M_WAITOK); + nm = malloc(sizeof(*nm), M_DEVBUF, M_WAITOK); strlcpy(nm->gp_name, set->gp_name2, sizeof(nm->gp_name)); nm->gp_pin = set->gp_pin; @@ -504,7 +503,7 @@ gpioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) LIST_FOREACH(nm, &sc->sc_names, gp_next) { if (nm->gp_pin == pin) { LIST_REMOVE(nm, gp_next); - free(nm, M_DEVBUF, 0); + free(nm, M_DEVBUF, sizeof(*nm)); break; } } |