The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=dd636cb9d04eb075c8425b9f825ca6ac29b9e01d

commit dd636cb9d04eb075c8425b9f825ca6ac29b9e01d
Author:     John Baldwin <[email protected]>
AuthorDate: 2022-04-13 23:08:23 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2022-04-13 23:08:23 +0000

    ad7417: Avoid an unused but set warning when compiled with NO_SYSCTL_DESCR.
    
    Use a ternary operator for the description string passed to
    SYSCTL_ADD_PROC instead of a helper variable.
---
 sys/dev/iicbus/ad7417.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/dev/iicbus/ad7417.c b/sys/dev/iicbus/ad7417.c
index 43170ce2e81f..6e110d698a4d 100644
--- a/sys/dev/iicbus/ad7417.c
+++ b/sys/dev/iicbus/ad7417.c
@@ -409,7 +409,6 @@ ad7417_attach(device_t dev)
        char sysctl_name[32];
        int i, j;
        const char *unit;
-       const char *desc;
 
        sc = device_get_softc(dev);
 
@@ -450,17 +449,17 @@ ad7417_attach(device_t dev)
 
                if (sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR) {
                        unit = "temp";
-                       desc = "sensor unit (C)";
                } else {
                        unit = "volt";
-                       desc = "sensor unit (mV)";
                }
                /* I use i to pass the sensor id. */
                SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
                                unit, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
                                dev, i, ad7417_sensor_sysctl,
                                sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR ?
-                               "IK" : "I", desc);
+                               "IK" : "I",
+                               sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR ?
+                               "sensor unit (C)" : "sensor unit (mV)");
        }
        /* Dump sensor location, ID & type. */
        if (bootverbose) {

Reply via email to