From nobody Sun Jun 16 20:38:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4W2Pwd5Y5Zz5PRML; Sun, 16 Jun 2024 20:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W2Pwd387nz3xRF; Sun, 16 Jun 2024 20:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718570289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VKCl+d3KvfBmb7MpDhh2NIQ/fdl1H4iQFSQiKVejOJA=; b=YAWiDt6R9UUstLehq66HE6vzg7TTwNWjyTYHcSDkofXGQLvs+cCoVeqnoIzdwTElzedVi7 8ZyTo2kW6oLQElhQOrr11JdEB7GieXuIJRb1aj1AuZmWC/4ppv9mthlEaDQylkyW0aHVi9 PQXKJkICimVywtZ3zoqn0MYrylT04ufdcxKY0P3/VodLrFJUV2PUAYe6yfjphzJHXnjDl8 OBzUAFedwsnKE9aWwy3Miy7HrL7qcmNkngC2rqCeP9br2Hb11HpfWBka+DHrAlfMPN3UI2 8hcAFFbxrMbao2aKOk3InqRaz+odh1Km7xyVkwW9gKGDHnHc7FAP7DXpP8g7eg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718570289; a=rsa-sha256; cv=none; b=PFLns0MJEj7MdEK+dqQZzUZOLwDrJ9nNqUjHBdfdHNQBvQ2TQFlxep/FBdVV5XS51/rgvh u37VVqgw9jr1g5iwDZ5fWVlJjumwlBOLM/mtAfbkbyqXzcX6WBLW3XbaGY4vDlYgs0E8xl Txswm9t9VKeBhCCSegrZn8ctK6/CeRYoCNA1/bMQhT5wCqwJMQtK9GZokllLHjtCJlOf/o Bc9WfijrhSY30uS0tSlNbUyKDyF/6wye/iDe6Inj8hIIVtjtImEQaNl9UVeP0SotcBVcj5 bSOnBDoJPNfrYzMN7HDY70d79e3PN4DjbYWu3UiV00VakeEss/l2nR8Mg1CEqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718570289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VKCl+d3KvfBmb7MpDhh2NIQ/fdl1H4iQFSQiKVejOJA=; b=OfBVNo39qA81+x9bO7jfilUmo/QKQawE7he8CYnaP7W/IimqzRWYuY5QyCCTAboDKzw69Y oY83wb2J8dF94CrSUgAZLW2/ToH4de7cfFh+4wC0K5bQsGWIxCM4evLjYROuV1AUF6C3lj 9yGFQli1TG4VWQkdf9yX7xMiEWxV8Wk5MXicOKhCp1AQB+AKq3ZP7dfiR/mZPPZ6vB1O5Y oaLmeFHFR2sd49nGEJAy/eOnNaJHfkFuIVBWzBvDR53OaB9SLbdMVVkGc7CgvoSjVFocmb EgmcVlFFUaV3JCeowIKxQC65eZ/XyhGjV1hjQ2VVzcoh7ePfHotD7G1XSvXzpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4W2Pwd2jglz12wJ; Sun, 16 Jun 2024 20:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45GKc9De079914; Sun, 16 Jun 2024 20:38:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45GKc9nw079911; Sun, 16 Jun 2024 20:38:09 GMT (envelope-from git) Date: Sun, 16 Jun 2024 20:38:09 GMT Message-Id: <202406162038.45GKc9nw079911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 83caa244bc9e - main - jedec_dimm: Use device_set_descf() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83caa244bc9eef6949a1250a875ad1409775a46e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=83caa244bc9eef6949a1250a875ad1409775a46e commit 83caa244bc9eef6949a1250a875ad1409775a46e Author: Mark Johnston AuthorDate: 2024-06-05 19:34:30 +0000 Commit: Mark Johnston CommitDate: 2024-06-16 20:37:26 +0000 jedec_dimm: Use device_set_descf() Note that it is ok to use device_get_desc() as one of the format string parameters because it is set using device_set_desc() (not device_set_desc_copy()) and so won't be freed when the description is updated. No functional change intended. MFC after: 1 week --- sys/dev/jedec_dimm/jedec_dimm.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/sys/dev/jedec_dimm/jedec_dimm.c b/sys/dev/jedec_dimm/jedec_dimm.c index ddaa0e96856e..697e7695a009 100644 --- a/sys/dev/jedec_dimm/jedec_dimm.c +++ b/sys/dev/jedec_dimm/jedec_dimm.c @@ -265,7 +265,6 @@ jedec_dimm_attach(device_t dev) uint16_t vendorid; bool tsod_present; int rc; - int new_desc_len; enum dram_type type; struct jedec_dimm_softc *sc; struct sysctl_ctx_list *ctx; @@ -273,7 +272,6 @@ jedec_dimm_attach(device_t dev) struct sysctl_oid_list *children; const char *tsod_match; const char *slotid_str; - char *new_desc; sc = device_get_softc(dev); ctx = device_get_sysctl_ctx(dev); @@ -447,26 +445,13 @@ no_tsod: * device description. */ if ((tsod_match != NULL) || (sc->slotid_str != NULL)) { - new_desc_len = strlen(device_get_desc(dev)); - if (tsod_match != NULL) { - new_desc_len += strlen(tsod_match); - new_desc_len += 4; /* " w/ " */ - } - if (sc->slotid_str != NULL) { - new_desc_len += strlen(sc->slotid_str); - new_desc_len += 3; /* space + parens */ - } - new_desc_len++; /* terminator */ - new_desc = malloc(new_desc_len, M_TEMP, (M_WAITOK | M_ZERO)); - (void) snprintf(new_desc, new_desc_len, "%s%s%s%s%s%s", + device_set_descf(dev, "%s%s%s%s%s%s", device_get_desc(dev), (tsod_match ? " w/ " : ""), (tsod_match ? tsod_match : ""), (sc->slotid_str ? " (" : ""), (sc->slotid_str ? sc->slotid_str : ""), (sc->slotid_str ? ")" : "")); - device_set_desc_copy(dev, new_desc); - free(new_desc, M_TEMP); } out: