Page MenuHomeFreeBSD

D61303.1794711322.diff
No OneTemporary

Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None

D61303.1794711322.diff

diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -151,7 +151,8 @@
if (rv > 0)
return (rv);
product = kern_getenv("smbios.system.product");
- device_set_descf(dev, "Apple %s", product ? product : "SMC");
+ device_set_descf(dev, "Apple %s",
+ product != NULL ? product : "SMC");
freeenv(product);
return (rv);
}
@@ -316,7 +317,7 @@
ret = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE,
asmc_sms_intrfast, NULL, dev, &sc->sc_cookie);
- if (ret) {
+ if (ret != 0) {
device_printf(dev, "unable to setup SMS IRQ\n");
goto err;
}
@@ -735,7 +736,7 @@
char *sensor_key;
for (unsigned int i = start; i < end; i++) {
- if (asmc_key_dump_by_index(dev, i, key, type, &len))
+ if (asmc_key_dump_by_index(dev, i, key, type, &len) != 0)
continue;
if (len != 2 || (prefix != '\0' && key[0] != prefix))
continue;
diff --git a/sys/dev/asmc/asmc_debug.c b/sys/dev/asmc/asmc_debug.c
--- a/sys/dev/asmc/asmc_debug.c
+++ b/sys/dev/asmc/asmc_debug.c
@@ -40,13 +40,13 @@
int error;
error = asmc_key_dump_by_index(dev, number, key, type, &len);
- if (error)
+ if (error != 0)
return (error);
len = MIN(len, sizeof(v));
memset(v, 0, sizeof(v));
error = asmc_key_read(dev, key, v, len);
- if (error)
+ if (error != 0)
return (error);
sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
@@ -94,7 +94,7 @@
strlcpy(newkey, sc->sc_rawkey, sizeof(newkey));
error = sysctl_handle_string(oidp, newkey, sizeof(newkey), req);
- if (error || req->newptr == NULL)
+ if (error != 0 || req->newptr == NULL)
return (error);
if (strlen(newkey) != ASMC_KEYLEN)
@@ -137,7 +137,7 @@
hexbuf[i * 2] = '\0';
error = sysctl_handle_string(oidp, hexbuf, sizeof(hexbuf), req);
- if (error || req->newptr == NULL)
+ if (error != 0 || req->newptr == NULL)
return (error);
/* Reject writes until a key is selected via raw.key. */
diff --git a/sys/dev/asmc/asmc_pio.c b/sys/dev/asmc/asmc_pio.c
--- a/sys/dev/asmc/asmc_pio.c
+++ b/sys/dev/asmc/asmc_pio.c
@@ -105,7 +105,7 @@
for (int i = 0; i < len; i++) {
ASMC_DATAPORT_WRITE(sc, buf[i]);
- if (asmc_wait(dev, status))
+ if (asmc_wait(dev, status) != 0)
return (1);
}
@@ -119,7 +119,7 @@
struct asmc_softc *sc = device_get_softc(dev);
for (int i = 0; i < len; i++) {
- if (asmc_wait(dev, status))
+ if (asmc_wait(dev, status) != 0)
return (1);
buf[i] = ASMC_DATAPORT_READ(sc);
}
@@ -139,10 +139,11 @@
index_buf[2] = (index >> 8) & 0xff;
index_buf[3] = index & 0xff;
- if (asmc_command(dev, ASMC_CMDGETBYINDEX))
+ if (asmc_command(dev, ASMC_CMDGETBYINDEX) != 0)
return (1);
- if (asmc_pio_send(dev, index_buf, ASMC_KEYLEN, ASMC_STATUS_AWAIT_DATA))
+ if (asmc_pio_send(dev, index_buf, ASMC_KEYLEN,
+ ASMC_STATUS_AWAIT_DATA) != 0)
return (1);
ASMC_DATAPORT_WRITE(sc, ASMC_KEYLEN);
@@ -156,10 +157,10 @@
{
struct asmc_softc *sc = device_get_softc(dev);
- if (asmc_command(dev, ASMC_CMDGETINFO))
+ if (asmc_command(dev, ASMC_CMDGETINFO) != 0)
return (1);
- if (asmc_pio_send(dev, key, ASMC_KEYLEN, ASMC_STATUS_AWAIT_DATA))
+ if (asmc_pio_send(dev, key, ASMC_KEYLEN, ASMC_STATUS_AWAIT_DATA) != 0)
return (1);
ASMC_DATAPORT_WRITE(sc, ASMC_KEYINFO_RESPLEN);
@@ -189,21 +190,21 @@
mtx_lock_spin(&sc->sc_mtx);
begin:
- if (asmc_command(dev, ASMC_CMDREAD))
+ if (asmc_command(dev, ASMC_CMDREAD) != 0)
goto out;
if (asmc_pio_send(dev, (const uint8_t *)key, ASMC_KEYLEN,
- ASMC_STATUS_AWAIT_DATA))
+ ASMC_STATUS_AWAIT_DATA) != 0)
goto out;
ASMC_DATAPORT_WRITE(sc, len);
- if (asmc_pio_recv(dev, buf, len, ASMC_STATUS_DATA_READY))
+ if (asmc_pio_recv(dev, buf, len, ASMC_STATUS_DATA_READY) != 0)
goto out;
error = 0;
out:
- if (error) {
+ if (error != 0) {
if (++try < 10)
goto begin;
device_printf(dev, "%s for key %s failed %d times, giving up\n",
@@ -289,12 +290,12 @@
begin:
ASMC_DPRINTF(("cmd port: cmd write\n"));
- if (asmc_command(dev, ASMC_CMDWRITE))
+ if (asmc_command(dev, ASMC_CMDWRITE) != 0)
goto out;
ASMC_DPRINTF(("data port: key\n"));
if (asmc_pio_send(dev, (const uint8_t *)key, ASMC_KEYLEN,
- ASMC_STATUS_AWAIT_DATA))
+ ASMC_STATUS_AWAIT_DATA) != 0)
goto out;
ASMC_DPRINTF(("data port: length\n"));
@@ -302,14 +303,14 @@
ASMC_DPRINTF(("data port: buffer\n"));
for (int i = 0; i < len; i++) {
- if (asmc_wait(dev, ASMC_STATUS_AWAIT_DATA))
+ if (asmc_wait(dev, ASMC_STATUS_AWAIT_DATA) != 0)
goto out;
ASMC_DATAPORT_WRITE(sc, buf[i]);
}
error = 0;
out:
- if (error) {
+ if (error != 0) {
if (++try < 10)
goto begin;
device_printf(dev, "%s for key %s failed %d times, giving up\n",
diff --git a/sys/dev/asmc/asmc_sysctl.c b/sys/dev/asmc/asmc_sysctl.c
--- a/sys/dev/asmc/asmc_sysctl.c
+++ b/sys/dev/asmc/asmc_sysctl.c
@@ -788,7 +788,7 @@
error = asmc_key_read(dev, fmkey, buf, 1);
if (error != 0)
return (error);
- v = buf[0] ? 1 : 0;
+ v = buf[0] != 0 ? 1 : 0;
error = sysctl_handle_int(oidp, &v, 0, req);
if (error == 0 && req->newptr != NULL) {
@@ -823,7 +823,7 @@
val = (buf[0] << 8) | buf[1];
/* Modify single bit */
- if (v) {
+ if (v != 0) {
val |= (1 << fan); /* Set to manual */
} else {
val &= ~(1 << fan); /* Set to auto */
diff --git a/sys/dev/asmc/asmcmmio.c b/sys/dev/asmc/asmcmmio.c
--- a/sys/dev/asmc/asmcmmio.c
+++ b/sys/dev/asmc/asmcmmio.c
@@ -65,7 +65,7 @@
mtx_lock_spin(&sc->sc_mtx);
/* Clear status if non-zero */
- if (bus_read_1(sc->sc_iomem, ASMC_MMIO_STATUS))
+ if (bus_read_1(sc->sc_iomem, ASMC_MMIO_STATUS) != 0)
bus_write_1(sc->sc_iomem, ASMC_MMIO_STATUS, 0);
/* Write key name as raw 4 bytes */

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 15, 2:55 AM (5 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41652678
Default Alt Text
D61303.1794711322.diff (5 KB)

Event Timeline