From nobody Thu Jun 27 15:31:17 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 4W92bV2HlVz5Ptv5; Thu, 27 Jun 2024 15:31:18 +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 4W92bT3p2yz4CdS; Thu, 27 Jun 2024 15:31:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719502277; 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=hGEZWacbsmc7lMacLXYsBBPzkO6hDE4rknc6itcukMk=; b=MDhtCuPihNqaQ5kvBbs6lhpso3rSR7na8PWj827TMILwaUzGFZRiMg7AM+yPuH2fSRxCpX xrSBqhUFviyCfXzw/FE1vSnemQucc198BUUh9nukwYdaoEx6NdSU4cP9qkhrEtEap7PMzJ rop0sGGlfgBNWSjWaO+XapqysVkUP2g6Hf3qO9cU2SjRCMjqroMCK/43zzW52TcOF9oqrb G2WUPE3+7Px35kQQBaJ4rZOaXa1xP4ZP8U1k4ycyKoJ3gctd31/TPA7HRNyXTPBysoXfqn PZVMTO8aI307uMLBvQiNWtpmCoXzuUYX5CaoEqdOFIwFBAA1k9F1bD5M/wuYrQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719502277; a=rsa-sha256; cv=none; b=XhZ+W8Wtd7tNFaAzpPw5+iySjTYhTBC9FDZHiWKc/ojY7KAJ1Wseh9w3Lod3XHPMYtuRK0 oIIDdWoUDmPH4MNUfEEDtJ7/7JmXLMvwGZ+/EzVj+w0V6RiUQff4G4NV6Vle5+HLkqMLVQ EhiQZZrEn3OsvRobB4QENrrl1F9u2p5X4d441OYlpUfCPSbwg21Lsb0CYEmatmWCL7NZFM CMdgDkQ+jk5KC20E/3Pmue6B76eGJysEmWB6ykjb+rUt/pRH/JLOiSmsafG1lWQvV8VR+V Pnh54P1sEgNhY+EW4Uw4vLI2RUsZYUKEnk9qVKQp7ZRL3i1RjLmzymlE+1Uoxg== 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=1719502277; 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=hGEZWacbsmc7lMacLXYsBBPzkO6hDE4rknc6itcukMk=; b=ihOHVQsGi6UUq3mzlVdKNWGDb+7kdXXuGgW4mCqcwR1q36vGmW3z0SH5K6ZaCAjHjT5Eku J0WI1BKZ9FPOErjVi24IM89XGfSxQm+Gd7t2hmmjBsExwHm8aXVl8B3J6X/+gzPq9oJinT Wd9k8YWYOlZk+BmeWxW7flcUVNl8AuQROgvrlzUP5RCaDxjkX9GIQ+Vqgyxeo9niEXa0Kv 3rZkYnOsEnaN/VwVlY+8ZmdiPrQ1iM4o7BJm+MjylQ6i4rcMwYF7D/0uaihi1Kzwc58JHQ CI9OepdZVKJGZQG7rsDAZIjbgA7j98tfYyLzpbktHN7Uma+MeM7vVsS5I7WRaw== 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 4W92bT36gpzJDM; Thu, 27 Jun 2024 15:31:17 +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 45RFVHZv079136; Thu, 27 Jun 2024 15:31:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45RFVHKK079133; Thu, 27 Jun 2024 15:31:17 GMT (envelope-from git) Date: Thu, 27 Jun 2024 15:31:17 GMT Message-Id: <202406271531.45RFVHKK079133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0d03585e6bc7 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 0d03585e6bc7effbbf52bbe49a4ee33e4b8a7889 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0d03585e6bc7effbbf52bbe49a4ee33e4b8a7889 commit 0d03585e6bc7effbbf52bbe49a4ee33e4b8a7889 Author: Mark Johnston AuthorDate: 2024-06-05 19:34:30 +0000 Commit: Mark Johnston CommitDate: 2024-06-27 15:27:42 +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 (cherry picked from commit 83caa244bc9eef6949a1250a875ad1409775a46e) --- 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: