diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2009-07-15 20:52:05 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2009-07-15 20:52:05 +0000 |
commit | 8dd45d0c3bae3331c278442e2fbb622ee39fed2d (patch) | |
tree | 91125b07434c2627875d981951dbf2cc1b089536 /sys | |
parent | 69f62b8724c7a77706ff3cb10cdc25ab70544404 (diff) |
In sdmmc_intr_establish(), don't duplicate the `name' parameter.
Instead, just use the pointer, and don't free the pointer during
sdmmc_intr_disestablish().
ok miod.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sdmmc/sdmmc_io.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c index a335a81e4f0..816f3cfe23f 100644 --- a/sys/dev/sdmmc/sdmmc_io.c +++ b/sys/dev/sdmmc/sdmmc_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_io.c,v 1.14 2009/06/29 19:42:09 mk Exp $ */ +/* $OpenBSD: sdmmc_io.c,v 1.15 2009/07/15 20:52:04 mk Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -31,7 +31,7 @@ struct sdmmc_intr_handler { struct sdmmc_softc *ih_softc; - char *ih_name; + const char *ih_name; int (*ih_fun)(void *); void *ih_arg; TAILQ_ENTRY(sdmmc_intr_handler) entry; @@ -616,7 +616,6 @@ sdmmc_intr_establish(struct device *sdmmc, int (*fun)(void *), struct sdmmc_softc *sc = (struct sdmmc_softc *)sdmmc; struct sdmmc_intr_handler *ih; int s; - size_t namesz; if (sc->sct->card_intr_mask == NULL) return NULL; @@ -625,13 +624,7 @@ sdmmc_intr_establish(struct device *sdmmc, int (*fun)(void *), if (ih == NULL) return NULL; - namesz = strlen(name) + 1; - ih->ih_name = malloc(namesz, M_DEVBUF, M_WAITOK | M_CANFAIL); - if (ih->ih_name == NULL) { - free(ih, M_DEVBUF); - return NULL; - } - strlcpy(ih->ih_name, name, namesz); + ih->ih_name = name; ih->ih_softc = sc; ih->ih_fun = fun; ih->ih_arg = arg; @@ -667,7 +660,6 @@ sdmmc_intr_disestablish(void *cookie) } splx(s); - free(ih->ih_name, M_DEVBUF); free(ih, M_DEVBUF); } |