mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
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
This commit is contained in:
parent
131c8ee733
commit
83caa244bc
|
@ -265,7 +265,6 @@ jedec_dimm_attach(device_t dev)
|
||||||
uint16_t vendorid;
|
uint16_t vendorid;
|
||||||
bool tsod_present;
|
bool tsod_present;
|
||||||
int rc;
|
int rc;
|
||||||
int new_desc_len;
|
|
||||||
enum dram_type type;
|
enum dram_type type;
|
||||||
struct jedec_dimm_softc *sc;
|
struct jedec_dimm_softc *sc;
|
||||||
struct sysctl_ctx_list *ctx;
|
struct sysctl_ctx_list *ctx;
|
||||||
|
@ -273,7 +272,6 @@ jedec_dimm_attach(device_t dev)
|
||||||
struct sysctl_oid_list *children;
|
struct sysctl_oid_list *children;
|
||||||
const char *tsod_match;
|
const char *tsod_match;
|
||||||
const char *slotid_str;
|
const char *slotid_str;
|
||||||
char *new_desc;
|
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
ctx = device_get_sysctl_ctx(dev);
|
ctx = device_get_sysctl_ctx(dev);
|
||||||
|
@ -447,26 +445,13 @@ jedec_dimm_attach(device_t dev)
|
||||||
* device description.
|
* device description.
|
||||||
*/
|
*/
|
||||||
if ((tsod_match != NULL) || (sc->slotid_str != NULL)) {
|
if ((tsod_match != NULL) || (sc->slotid_str != NULL)) {
|
||||||
new_desc_len = strlen(device_get_desc(dev));
|
device_set_descf(dev, "%s%s%s%s%s%s",
|
||||||
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_get_desc(dev),
|
device_get_desc(dev),
|
||||||
(tsod_match ? " w/ " : ""),
|
(tsod_match ? " w/ " : ""),
|
||||||
(tsod_match ? tsod_match : ""),
|
(tsod_match ? tsod_match : ""),
|
||||||
(sc->slotid_str ? " (" : ""),
|
(sc->slotid_str ? " (" : ""),
|
||||||
(sc->slotid_str ? sc->slotid_str : ""),
|
(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:
|
out:
|
||||||
|
|
Loading…
Reference in a new issue