* [PATCH] nfc: trf7970a: power down on startup RX gain failure
@ 2026-09-13 4:26 Myeonghun Pak
2026-09-14 13:22 ` Paul Geurts
0 siblings, 1 reply; 2+ messages in thread
From: Myeonghun Pak @ 2026-09-13 4:26 UTC (permalink / raw)
To: Mark Greer, David Heidelberg
Cc: Paul Geurts, linux-wireless, oe-linux-nfc, linux-kernel, stable,
Ijae Kim
trf7970a_startup() powers up the device before applying the optional RX
gain reduction. If the register read or write fails, it returns without
undoing that power-up. Probe's unwind only drops the separate regulator
references acquired by probe, leaving the additional VIN enable from
startup unbalanced. The system resume caller also has no power-down on
this error.
Call trf7970a_power_down() before returning the RX gain error to deassert
the enable GPIOs, release the startup VIN reference and restore the
powered-off state. Runtime PM has not been enabled yet, so the full
shutdown helper is not appropriate here. Preserve the original SPI error.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 5d69351820ea ("NFC: trf7970a: Create device-tree parameter for RX gain reduction")
Cc: stable@vger.kernel.org
Assisted-by: OpenAI:GPT-5.6
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/nfc/trf7970a.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 60883001f..ddfc58c29 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1997,8 +1997,10 @@ static int trf7970a_startup(struct trf7970a *trf)
return ret;
ret = trf7970a_update_rx_gain_reduction(trf);
- if (ret)
+ if (ret) {
+ trf7970a_power_down(trf);
return ret;
+ }
pm_runtime_set_active(trf->dev);
pm_runtime_enable(trf->dev);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] nfc: trf7970a: power down on startup RX gain failure
2026-09-13 4:26 [PATCH] nfc: trf7970a: power down on startup RX gain failure Myeonghun Pak
@ 2026-09-14 13:22 ` Paul Geurts
0 siblings, 0 replies; 2+ messages in thread
From: Paul Geurts @ 2026-09-14 13:22 UTC (permalink / raw)
To: mhun512, mgreer, david
Cc: linux-wireless, oe-linux-nfc, linux-kernel, stable, ae878000,
Paul Geurts
> trf7970a_startup() powers up the device before applying the optional RX
> gain reduction. If the register read or write fails, it returns without
> undoing that power-up. Probe's unwind only drops the separate regulator
> references acquired by probe, leaving the additional VIN enable from
> startup unbalanced. The system resume caller also has no power-down on
> this error.
>
> Call trf7970a_power_down() before returning the RX gain error to deassert
> the enable GPIOs, release the startup VIN reference and restore the
> powered-off state. Runtime PM has not been enabled yet, so the full
> shutdown helper is not appropriate here. Preserve the original SPI error.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
Yes, we should do power_down here indeed.
Thanks!
Reviewed-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
br,
Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-14 13:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 4:26 [PATCH] nfc: trf7970a: power down on startup RX gain failure Myeonghun Pak
2026-09-14 13:22 ` Paul Geurts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®