mfd: wm831x: Fix typo "convertor" in comment
Subsystems (2)
PATCH v3 1/1 mfd: wm831x: Fix typo "convertor" in comment
Correct "convertor" to "converter", reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches a comment, no code changes.
Since v1 the subject carries the driver name and a capitalised description, to match the MFD subsystem convention.
---
Changes since v2:
- sent on its own instead of as part of a cirrus series. Mark Brown asked for patches touching different subsystems not to be grouped into one series when there is no dependency between them.
drivers/mfd/wm831x-auxadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/wm831x-auxadc.c +1 -1
@@ -132,7 +132,7 @@ static irqreturn_t wm831x_auxadc_irq(int irq, void *irq_data) 1 << input, 0); wm831x->auxadc_active &= ~(1 << input); -/* Turn off the entire convertor if idle */ +/* Turn off the entire converter if idle */ if (!wm831x->auxadc_active)wm831x_reg_write (wm831x,WM831X_AUXADC_CONTROL ,0 );
Signature · 1 line
2.48.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but memory corruption can occur due to freeing a list element without removing it from the list in wm831x_auxadc_read_irq.
- [High] This problem wasn't introduced by this patch, but a broken polling loop in wm831x_auxadc_read_polled causes premature timeout.
--
commit c4685699a90d5d341f26100b93279945ad18d7cc
Author: Hemanth Selam <[email protected]>
mfd: wm831x: Fix typo "convertor" in comment
Correct "convertor" to "converter", reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches a comment, no code changes.
drivers/mfd/wm831x-auxadc.c static irqreturn_t wm831x_auxadc_irq(int irq, void *irq_data) · line 143
Quoted 12 lines
drivers/mfd/wm831x-auxadc.c +1
-1@@ -138,7 +138,7 @@ static irqreturn_t wm831x_auxadc_irq(int irq, void *irq_data) 1 << input, 0); wm831x->auxadc_active &= ~(1 << input); -/* Turn off the entire convertor if idle */ +/* Turn off the entire converter if idle */ if (!wm831x->auxadc_active)wm831x_reg_write (wm831x,WM831X_AUXADC_CONTROL ,0 );
While reviewing this file, I noticed a couple of pre-existing issues in the surrounding code.
In drivers/mfd/wm831x-auxadc.c:wm831x_auxadc_read_irq():
Quoted 18 lines
drivers/mfd/wm831x-auxadc.c +0
-0/* Enqueue the request */ list_add(&req->list, &wm831x->auxadc_pending); ena = !wm831x->auxadc_active; if (ena) { ret = wm831x_set_bits(wm831x, WM831X_AUXADC_CONTROL, WM831X_AUX_ENA, WM831X_AUX_ENA); if (ret != 0) { dev_err(wm831x->dev, "Failed to enable AUXADC: %d\n", ret); goto out; } } [ ... ] list_del(&req->list); ret = req->val;
Quoted 6 lines
out:
mutex_unlock(&wm831x->auxadc_lock); kfree(req); return ret;
[Severity: High]
This isn't a bug introduced by this patch, but memory corruption can occur due to freeing a list element without removing it from the list in wm831x_auxadc_read_irq.
If wm831x_set_bits() fails and jumps to the out label, the dynamically allocated req structure is freed via kfree(req) while it is still linked in the wm831x->auxadc_pending list.
Could this leave a dangling pointer in the pending list that might be dereferenced during subsequent calls to the interrupt handler wm831x_auxadc_irq() or other wm831x_auxadc_read_irq() calls?
Also in drivers/mfd/wm831x-auxadc.c:wm831x_auxadc_read_polled():
Quoted 19 lines
/* If we're not using interrupts then poll the
* interrupt status register */
timeout = 5;
while (timeout) {
msleep(1);
ret = wm831x_reg_read(wm831x,
WM831X_INTERRUPT_STATUS_1);
if (ret < 0) {
dev_err(wm831x->dev,
"ISR 1 read failed: %d\n", ret);
goto disable;
}
/* Did it complete? */
if (ret & WM831X_AUXADC_DATA_EINT) {
wm831x_reg_write(wm831x,
WM831X_INTERRUPT_STATUS_1,
WM831X_AUXADC_DATA_EINT);Quoted 8 lines
break;
} else {
dev_err(wm831x->dev,
"AUXADC conversion timeout\n");
ret = -EBUSY;
goto disable;
}
}[Severity: High]
This isn't a bug introduced by this patch, but a broken polling loop in wm831x_auxadc_read_polled causes premature timeout.
When the driver falls back to polled mode, the else block unconditionally aborts the polling loop on the first failure after a 1ms delay. The timeout variable is also never decremented.
Does this structural issue prevent the while (timeout) loop from actually functioning as a polling loop, unconditionally returning -EBUSY if the ADC takes slightly longer than 1ms to finish?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1