From: mlarkin Date: Wed, 21 May 2014 02:14:07 +0000 (+0000) Subject: Fix invalid / missing format specifiers in several dnprintf statements X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7a27271e503f2515263c54cf0351b612e0e3a96f;p=openbsd Fix invalid / missing format specifiers in several dnprintf statements (used only when ACPI_DEBUG is enabled) From a diff on tech@ by Fabian Raetz, with a minor change by me, tested on i386 and amd64 with ACPI_DEBUG enabled and disabled. --- diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index a045de8178b..8a84dec74af 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.257 2014/04/25 14:37:06 mlarkin Exp $ */ +/* $OpenBSD: acpi.c,v 1.258 2014/05/21 02:14:07 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -431,13 +431,13 @@ int acpi_matchhids(struct acpi_attach_args *aa, const char *hids[], const char *driver) { - if (aa->aaa_dev == NULL || aa->aaa_node == NULL) return (0); if (_acpi_matchhids(aa->aaa_dev, hids)) { - dnprintf(5, "driver %s matches %s\n", driver, hids); + dnprintf(5, "driver %s matches at least one hid\n", driver); return (1); } + return (0); } #endif /* SMALL_KERNEL */ @@ -1336,7 +1336,7 @@ acpi_map_pmregs(struct acpi_softc *sc) break; } if (size && addr) { - dnprintf(50, "mapping: %.4x %.4x %s\n", + dnprintf(50, "mapping: %.4lx %.4lx %s\n", addr, size, name); /* Size and address exist; map register space */ diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c index 1a62b4dc1a6..41a2c85feef 100644 --- a/sys/dev/acpi/acpicpu.c +++ b/sys/dev/acpi/acpicpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpicpu.c,v 1.57 2010/07/21 19:35:15 deraadt Exp $ */ +/* $OpenBSD: acpicpu.c,v 1.58 2014/05/21 02:14:07 mlarkin Exp $ */ /* * Copyright (c) 2005 Marco Peereboom * @@ -344,7 +344,7 @@ acpicpu_attach(struct device *parent, struct device *self, void *aux) #ifdef ACPI_DEBUG printf(": %s: ", sc->sc_devnode->name); printf("\n: hdr:%x pblk:%x,%x duty:%x,%x pstate:%x " - "(%d throttling states)\n", sc->sc_acpi->sc_fadt->hdr_revision, + "(%ld throttling states)\n", sc->sc_acpi->sc_fadt->hdr_revision, sc->sc_pblk_addr, sc->sc_pblk_len, sc->sc_duty_off, sc->sc_duty_wid, sc->sc_acpi->sc_fadt->pstate_cnt, CPU_MAXSTATE(sc)); @@ -519,7 +519,7 @@ acpicpu_getpct(struct acpicpu_softc *sc) goto ffh; } - dnprintf(10, "_PCT(ctrl) : %02x %04x %02x %02x %02x %02x %016x\n", + dnprintf(10, "_PCT(ctrl) : %02x %04x %02x %02x %02x %02x %016llx\n", sc->sc_pct.pct_ctrl.grd_descriptor, sc->sc_pct.pct_ctrl.grd_length, sc->sc_pct.pct_ctrl.grd_gas.address_space_id, @@ -528,7 +528,7 @@ acpicpu_getpct(struct acpicpu_softc *sc) sc->sc_pct.pct_ctrl.grd_gas.access_size, sc->sc_pct.pct_ctrl.grd_gas.address); - dnprintf(10, "_PCT(status): %02x %04x %02x %02x %02x %02x %016x\n", + dnprintf(10, "_PCT(status): %02x %04x %02x %02x %02x %02x %016llx\n", sc->sc_pct.pct_status.grd_descriptor, sc->sc_pct.pct_status.grd_length, sc->sc_pct.pct_status.grd_gas.address_space_id, diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c index 2b22265dd54..d42ec184b6a 100644 --- a/sys/dev/acpi/acpiec.c +++ b/sys/dev/acpi/acpiec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiec.c,v 1.48 2013/07/02 18:37:47 kettenis Exp $ */ +/* $OpenBSD: acpiec.c,v 1.49 2014/05/21 02:14:07 mlarkin Exp $ */ /* * Copyright (c) 2006 Can Erkin Acar * @@ -142,9 +142,10 @@ acpiec_read_data(struct acpiec_softc *sc) u_int8_t val; acpiec_wait(sc, EC_STAT_OBF, EC_STAT_OBF); - dnprintf(40, "acpiec: read_data\n", (int)val); val = bus_space_read_1(sc->sc_data_bt, sc->sc_data_bh, 0); + dnprintf(40, "acpiec: read_data %d\n", (int)val); + return (val); } @@ -482,7 +483,7 @@ acpiec_getcrs(struct acpiec_softc *sc, struct acpi_attach_args *aa) /* XXX: todo - validate _CRS checksum? */ ecdtdone: - dnprintf(10, "%s: Data: 0x%x, S/C: 0x%x\n", + dnprintf(10, "%s: Data: 0x%lx, S/C: 0x%lx\n", DEVNAME(sc), ec_data, ec_sc); if (ctype == GAS_SYSTEM_IOSPACE) diff --git a/sys/dev/acpi/atk0110.c b/sys/dev/acpi/atk0110.c index acd8e570e28..ef9aec19385 100644 --- a/sys/dev/acpi/atk0110.c +++ b/sys/dev/acpi/atk0110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atk0110.c,v 1.8 2014/02/21 16:25:57 deraadt Exp $ */ +/* $OpenBSD: atk0110.c,v 1.9 2014/05/21 02:14:07 mlarkin Exp $ */ /* * Copyright (c) 2009 Constantine A. Murenin @@ -448,13 +448,13 @@ aibs_getvalue(struct aibs_softc *sc, int64_t i, int64_t *v) } if (aml_evalnode(sc->sc_acpi, n, 1, &req, &res)) { - dprintf("%s: %s: %i: evaluation failed\n", + dprintf("%s: %s: %lld: evaluation failed\n", DEVNAME(sc), n->name, i); aml_freevalue(&res); return (-1); } if (res.type != type) { - dprintf("%s: %s: %i: not an integer: type %i\n", + dprintf("%s: %s: %lld: not an integer: type %i\n", DEVNAME(sc), n->name, i, res.type); aml_freevalue(&res); return (-1); @@ -462,14 +462,14 @@ aibs_getvalue(struct aibs_softc *sc, int64_t i, int64_t *v) if (sc->sc_mode) { if (res.length < sizeof(ret)) { - dprintf("%s: %s: %i: result buffer too small\n", + dprintf("%s: %s: %lld: result buffer too small\n", DEVNAME(sc), n->name, i); aml_freevalue(&res); return (-1); } bcopy(res.v_buffer, &ret, sizeof(ret)); if (ret.flags == 0) { - dprintf("%s: %s: %i: bad flags in result\n", + dprintf("%s: %s: %lld: bad flags in result\n", DEVNAME(sc), n->name, i); aml_freevalue(&res); return (-1); @@ -493,13 +493,13 @@ aibs_getpack(struct aibs_softc *sc, struct aml_node *n, int64_t i, req.v_integer = i; if (aml_evalnode(sc->sc_acpi, n, 1, &req, res)) { - dprintf("%s: %s: %i: evaluation failed\n", + dprintf("%s: %s: %lld: evaluation failed\n", DEVNAME(sc), n->name, i); aml_freevalue(res); return (-1); } if (res->type != AML_OBJTYPE_PACKAGE) { - dprintf("%s: %s: %i: not a package: type %i\n", + dprintf("%s: %s: %lld: not a package: type %i\n", DEVNAME(sc), n->name, i, res->type); aml_freevalue(res); return (-1); diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index 0fe6b80e01e..0d1313a45c8 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.208 2014/05/02 14:04:50 kettenis Exp $ */ +/* $OpenBSD: dsdt.c,v 1.209 2014/05/21 02:14:07 mlarkin Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave * @@ -424,7 +424,7 @@ _acpi_os_malloc(size_t size, const char *fn, int line) struct acpi_memblock *sptr; sptr = malloc(size+sizeof(*sptr), M_ACPI, M_WAITOK | M_ZERO); - dnprintf(99, "alloc: %x %s:%d\n", sptr, fn, line); + dnprintf(99, "alloc: %p %s:%d\n", sptr, fn, line); acpi_nalloc += size; sptr->size = size; #ifdef ACPI_MEMDEBUG @@ -451,7 +451,7 @@ _acpi_os_free(void *ptr, const char *fn, int line) LIST_REMOVE(sptr, link); #endif - dnprintf(99, "free: %x %s:%d\n", sptr, fn, line); + dnprintf(99, "free: %p %s:%d\n", sptr, fn, line); free(sptr, M_ACPI); } } @@ -552,7 +552,7 @@ aml_register_notify(struct aml_node *node, const char *pnpid, struct aml_notify_data *pdata; extern int acpi_poll_enabled; - dnprintf(10, "aml_register_notify: %s %s %x\n", + dnprintf(10, "aml_register_notify: %s %s %p\n", node->name, pnpid ? pnpid : "", proc); pdata = acpi_os_malloc(sizeof(struct aml_notify_data)); @@ -3124,7 +3124,7 @@ aml_eval(struct aml_scope *scope, struct aml_value *my_ret, int ret_type, case AML_OBJTYPE_BUFFERFIELD: case AML_OBJTYPE_FIELDUNIT: my_ret = aml_allocvalue(0,0,NULL); - dnprintf(20,"quick: Convert Bufferfield to %c 0x%x\n", + dnprintf(20,"quick: Convert Bufferfield to %c %p\n", ret_type, my_ret); aml_rwfield(tmp, 0, tmp->v_field.bitlen, my_ret, ACPI_IOREAD); break; @@ -3971,7 +3971,7 @@ aml_parse(struct aml_scope *scope, int ret_type, const char *stype) case AMLOP_NOTIFY: /* Notify: Si */ rv = aml_gettgt(opargs[0], opcode); - dnprintf(50,"Notifying: %s %x\n", + dnprintf(50,"Notifying: %s %llx\n", aml_nodename(rv->node), opargs[1]->v_integer); aml_notify(rv->node, opargs[1]->v_integer); @@ -4132,7 +4132,7 @@ aml_evalnode(struct acpi_softc *sc, struct aml_node *node, memset(res, 0, sizeof(*res)); if (node == NULL || node->value == NULL) return (ACPI_E_BADVALUE); - dnprintf(12,"EVALNODE: %s %d\n", aml_nodename(node), acpi_nalloc); + dnprintf(12,"EVALNODE: %s %lx\n", aml_nodename(node), acpi_nalloc); aml_error = 0; xres = aml_eval(NULL, node->value, 't', argc, argv); @@ -4205,7 +4205,7 @@ __aml_searchname(struct aml_node *root, const void *vname, int create) char nseg[AML_NAMESEG_LEN + 1]; int i; - dnprintf(25,"Searchname: %s:%s = ", aml_nodename(root), vname); + dnprintf(25,"Searchname: %s:%s = ", aml_nodename(root), name); while (*name == AMLOP_ROOTCHAR) { root = &aml_root; name++;