public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.19-6.1] watchdog: imx7ulp_wdt: handle the nowayout option
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
@ 2026-02-19  2:03 ` Sasha Levin
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: sun6i: Choose appropriate burst length under maxburst Sasha Levin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:03 UTC (permalink / raw)
  To: patches, stable
  Cc: Oleksandr Suvorov, Guenter Roeck, Frank Li, Wim Van Sebroeck,
	Sasha Levin, linux-watchdog, imx, linux-arm-kernel, linux-kernel

From: Oleksandr Suvorov <cryosay@gmail.com>

[ Upstream commit d303d37ef5cf86c8c3b2daefd2a7d7fd8ca1ec14 ]

The module parameter `nowayout` indicates whether the watchdog should ever
be allowed to stop, but the driver currently ignores this option.

Pass the `nowayout` parameter to the watchdog core by setting the
WDOG_NO_WAY_OUT flag accordingly.

Signed-off-by: Oleksandr Suvorov <cryosay@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Classification: Bug Fix

This is a **real bug fix**, not a feature addition. The driver:
1. **Already defines** the `nowayout` module parameter (lines 51-54)
2. **Already advertises** the parameter to users via `MODULE_PARM_DESC`
3. But **never applies** it to the watchdog device

This means a user could set `nowayout=1` expecting the watchdog to be
unstoppable once started, but the driver would silently ignore this
setting. This is a correctness bug with potential **safety/reliability
implications** — the `nowayout` feature exists specifically to prevent
accidental watchdog stops that could leave a system unmonitored.

## Stable Kernel Criteria Assessment

1. **Obviously correct and tested**: Yes. It's a single-line addition of
   `watchdog_set_nowayout(wdog, nowayout)` — the standard pattern used
   by 106 other watchdog drivers. Reviewed by Guenter Roeck (watchdog
   co-maintainer) and Frank Li.

2. **Fixes a real bug**: Yes. The module parameter `nowayout` is defined
   but ineffective. Users who rely on `nowayout=1` for system safety are
   not getting the protection they expect.

3. **Important issue**: Moderate. This is a safety feature for embedded
   systems using watchdog timers. If a user sets `nowayout=1` expecting
   the watchdog can never be stopped, but it can be stopped, a system
   failure could go undetected.

4. **Small and contained**: Yes. Single line addition in one file.

5. **No new features**: Correct. The feature (nowayout parameter)
   already exists and is already declared. This just makes it work as
   intended.

6. **Applies cleanly**: The change is a single line insertion with
   stable context.

## Risk Assessment

- **Risk**: Extremely low. This is a single call to a well-established
  inline function that sets one bit in a status field. The function is
  used in 106 other drivers identically.
- **Benefit**: Users of the imx7ulp watchdog (NXP i.MX7ULP SoC, used in
  embedded/IoT) get correct `nowayout` behavior.
- **Regression potential**: Near zero. The only behavioral change is
  that `nowayout=1` now actually works, which is what users who set it
  expect.

## Verification

- Verified that `nowayout` module parameter is defined at lines 51-54 of
  `drivers/watchdog/imx7ulp_wdt.c` but never applied via
  `watchdog_set_nowayout()` before this patch.
- Verified that `watchdog_set_nowayout()` is a simple inline function in
  `include/linux/watchdog.h` that just sets the `WDOG_NO_WAY_OUT` status
  bit.
- Verified that 106 other watchdog drivers in `drivers/watchdog/` follow
  the exact same pattern of calling `watchdog_set_nowayout()` in their
  probe function.
- Verified the commit is reviewed by Guenter Roeck (watchdog subsystem
  co-maintainer) — `Reviewed-by: Guenter Roeck <linux@roeck-us.net>`.
- Verified the change is a single line addition with no dependencies on
  other commits.
- The imx7ulp_wdt driver has existed since at least Linux 4.17 (based on
  the driver's maturity), meaning this bug affects all stable trees that
  include this driver.

## Conclusion

This is a clear, minimal bug fix for a watchdog driver that declares a
safety-critical module parameter but doesn't apply it. The fix is one
line, follows the established pattern used by 106 other drivers, and was
reviewed by the watchdog subsystem maintainer. The risk is essentially
zero and the benefit is correct behavior for a safety feature on
embedded systems.

**YES**

 drivers/watchdog/imx7ulp_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
index 0f13a30533574..03479110453ce 100644
--- a/drivers/watchdog/imx7ulp_wdt.c
+++ b/drivers/watchdog/imx7ulp_wdt.c
@@ -346,6 +346,7 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
 	watchdog_stop_on_reboot(wdog);
 	watchdog_stop_on_unregister(wdog);
 	watchdog_set_drvdata(wdog, imx7ulp_wdt);
+	watchdog_set_nowayout(wdog, nowayout);
 
 	imx7ulp_wdt->hw = of_device_get_match_data(dev);
 	ret = imx7ulp_wdt_init(imx7ulp_wdt, wdog->timeout * imx7ulp_wdt->hw->wdog_clock_rate);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH AUTOSEL 6.19-6.1] dmaengine: sun6i: Choose appropriate burst length under maxburst
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] watchdog: imx7ulp_wdt: handle the nowayout option Sasha Levin
@ 2026-02-19  2:03 ` Sasha Levin
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.18] pinctrl: mediatek: make devm allocations safer and clearer in mtk_eint_do_init() Sasha Levin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:03 UTC (permalink / raw)
  To: patches, stable
  Cc: Chen-Yu Tsai, Jernej Skrabec, Vinod Koul, Sasha Levin, samuel,
	dmaengine, linux-arm-kernel, linux-sunxi, linux-kernel

From: Chen-Yu Tsai <wens@kernel.org>

[ Upstream commit 7178c3586ab42693b28bb81014320a7783e5c435 ]

maxburst, as provided by the client, specifies the largest amount of
data that is allowed to be transferred in one burst. This limit is
normally provided to avoid a data burst overflowing the target FIFO.
It does not mean that the DMA engine can only do bursts in that size.

Let the driver pick the largest supported burst length within the
given limit. This lets the driver work correctly with some clients that
give a large maxburst value. In particular, the 8250_dw driver will give
a quarter of the UART's FIFO size as maxburst. On some systems the FIFO
size is 256 bytes, giving a maxburst of 64 bytes, while the hardware
only supports bursts of up to 16 bytes.

Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://patch.msgid.link/20251221080450.1813479-1-wens@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Analysis Summary

### What the commit fixes

This commit fixes a real bug where the sun6i DMA engine driver
incorrectly rejects valid DMA slave configurations. The DMA API's
`maxburst` field specifies the **maximum** burst size, not an exact
value. When a DMA client (like 8250_dw UART) provides a maxburst value
(e.g., 64) that isn't directly supported by the hardware (which only
supports 1, 4, 8, 16), the old code returned `-EINVAL`, causing DMA
transfers to fail completely.

The fix adds a `find_burst_size()` helper that selects the largest
supported burst length that doesn't exceed `maxburst`, which is the
correct DMA API semantics. This makes DMA work on real systems where
8250_dw UART gives maxburst=64 (quarter of a 256-byte FIFO) but the DMA
hardware supports bursts of at most 16.

### Stable kernel criteria assessment

1. **Obviously correct and tested**: Yes. The logic is simple - find
   largest power-of-two burst in the supported bitmask that fits within
   maxburst. Reviewed by Jernej Skrabec, applied by Vinod Koul.

2. **Fixes a real bug**: Yes. DMA transactions fail with `-EINVAL` on
   specific hardware combinations. This causes UART (and potentially
   other peripherals) to not work via DMA.

3. **Important issue**: Yes - this causes peripheral communication
   failure (UART DMA doesn't work on some Allwinner SoCs). Users with
   256-byte UART FIFOs and DMA-capable 8250_dw cannot use DMA at all.

4. **Small and contained**: Yes. Adds a ~14-line helper function,
   removes 4 lines of strict checks, and reorders 4 lines of existing
   code to call the new function first. Total change is well under 50
   lines in a single file.

5. **No new features**: Correct - this makes the driver handle the
   existing DMA API correctly. It's a bug fix to match the documented
   DMA maxburst semantics.

### Risk assessment

- **Low risk**: Changes are confined to one driver file
  (`drivers/dma/sun6i-dma.c`)
- **No regressions for existing users**: If maxburst was previously an
  exact match for hardware-supported values (1, 4, 8, or 16),
  `find_burst_size()` returns the same value as before. The behavior
  only changes for values that previously failed.
- **Well-tested helper**: `rounddown_pow_of_two` is a standard kernel
  utility available in all stable trees.
- **No dependency issues**: The `burst_lengths` infrastructure was
  introduced in 2017, present in all current stable kernels.

### User impact

Moderate-to-high for Allwinner ARM SoC users (embedded/IoT). These SoCs
are common in single-board computers (Orange Pi, Pine64, etc.) and
various embedded devices. The fix enables DMA-based UART operation where
it was previously broken.

## Verification

- **Verified** `burst_lengths` was introduced by commit d5f6d8cf31a89
  (2017-09-28), present in all stable trees.
- **Verified** `convert_burst()` only handles values 1, 4, 8, 16 (lines
  283-297), so the old code that directly passed unsupported values
  would return -EINVAL from both the explicit check AND from
  convert_burst.
- **Verified** the hardware configs show burst_lengths support
  BIT(1)|BIT(8) (A31/A23/A83t/D1) or BIT(1)|BIT(4)|BIT(8)|BIT(16)
  (H3/H6/V3s/A100), meaning a maxburst of 64 would fail on ALL variants.
- **Verified** `rounddown_pow_of_two` is available in
  `include/linux/log2.h` and is a long-standing kernel utility.
- **Verified** via git log that no other recent commits to this file are
  needed as dependencies.
- **Verified** via lore.kernel.org that the patch was reviewed by Jernej
  Skrabec and applied by maintainer Vinod Koul.
- **Could not verify** the exact 8250_dw maxburst=64 scenario from the
  8250_dw driver source (unverified, but the commit message describes a
  real hardware scenario credibly).

**YES**

 drivers/dma/sun6i-dma.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 2215ff877bf7d..f9d876deb1f05 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -583,6 +583,22 @@ static irqreturn_t sun6i_dma_interrupt(int irq, void *dev_id)
 	return ret;
 }
 
+static u32 find_burst_size(const u32 burst_lengths, u32 maxburst)
+{
+	if (!maxburst)
+		return 1;
+
+	if (BIT(maxburst) & burst_lengths)
+		return maxburst;
+
+	/* Hardware only does power-of-two bursts. */
+	for (u32 burst = rounddown_pow_of_two(maxburst); burst > 0; burst /= 2)
+		if (BIT(burst) & burst_lengths)
+			return burst;
+
+	return 1;
+}
+
 static int set_config(struct sun6i_dma_dev *sdev,
 			struct dma_slave_config *sconfig,
 			enum dma_transfer_direction direction,
@@ -616,15 +632,13 @@ static int set_config(struct sun6i_dma_dev *sdev,
 		return -EINVAL;
 	if (!(BIT(dst_addr_width) & sdev->slave.dst_addr_widths))
 		return -EINVAL;
-	if (!(BIT(src_maxburst) & sdev->cfg->src_burst_lengths))
-		return -EINVAL;
-	if (!(BIT(dst_maxburst) & sdev->cfg->dst_burst_lengths))
-		return -EINVAL;
 
 	src_width = convert_buswidth(src_addr_width);
 	dst_width = convert_buswidth(dst_addr_width);
-	dst_burst = convert_burst(dst_maxburst);
-	src_burst = convert_burst(src_maxburst);
+	src_burst = find_burst_size(sdev->cfg->src_burst_lengths, src_maxburst);
+	dst_burst = find_burst_size(sdev->cfg->dst_burst_lengths, dst_maxburst);
+	dst_burst = convert_burst(dst_burst);
+	src_burst = convert_burst(src_burst);
 
 	*p_cfg = DMA_CHAN_CFG_SRC_WIDTH(src_width) |
 		DMA_CHAN_CFG_DST_WIDTH(dst_width);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH AUTOSEL 6.19-6.18] pinctrl: mediatek: make devm allocations safer and clearer in mtk_eint_do_init()
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] watchdog: imx7ulp_wdt: handle the nowayout option Sasha Levin
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: sun6i: Choose appropriate burst length under maxburst Sasha Levin
@ 2026-02-19  2:03 ` Sasha Levin
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-5.10] phy: fsl-imx8mq-usb: disable bind/unbind platform driver feature Sasha Levin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:03 UTC (permalink / raw)
  To: patches, stable
  Cc: Liang Jie, fanggeng, Linus Walleij, Sasha Levin, sean.wang,
	matthias.bgg, angelogioacchino.delregno, linux-mediatek,
	linux-gpio, linux-kernel, linux-arm-kernel

From: Liang Jie <liangjie@lixiang.com>

[ Upstream commit 255b721c96046d4c57fa2268e4c72607868ce91f ]

mtk_eint_do_init() allocates several pointer arrays which are then
populated in a per-instance loop and freed on error. The arrays are
currently allocated with devm_kmalloc(), so their entries are left
uninitialised until the per-instance allocations succeed.

On a failure in the middle of the loop, the error path iterates over
the full nbase range and calls devm_kfree() on each element. For
indices which were never initialised, the corresponding array entries
contain stack garbage. If any of those happen to be non-zero,
devm_kfree() will pass them to devres_destroy(), which will WARN
because there is no matching devm_kmalloc() resource for such bogus
pointers.

Improve the robustness and readability by:

  - Using devm_kcalloc() for the pointer arrays so that all entries
    start as NULL, ensuring that only genuinely initialised elements
    may be freed and preventing spurious WARN_ON()s in the error path.
  - Switching the allocations to sizeof(*ptr) / sizeof(**ptr) forms,
    avoiding hard-coded element types and making the code more resilient
    to future type changes.
  - Dropping the redundant NULL checks before devm_kfree(), as
    devm_kfree() safely handles NULL pointers.

The functional behaviour in the successful initialisation path remains
unchanged, while the error handling becomes simpler and less
error-prone.

Reviewed-by: fanggeng <fanggeng@lixiang.com>
Signed-off-by: Liang Jie <liangjie@lixiang.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

So the buggy code is NOT in 6.12 or older LTS trees (as expected, since
it was added in 6.15). This fix is only relevant for 6.15+ stable trees.

### 7. Verification Summary

**Verification:**
- Read the current file (`mtk-eint.c` lines 520-622) — confirmed the
  buggy `devm_kmalloc()` calls at lines 547, 551, 555 and the error path
  at lines 598-606 that iterates over uninitialized entries.
- `git log` confirmed `3ef9f710efcb5` ("Add EINT support for multiple
  addresses") introduced the multi-base code with `nbase`, the loop, and
  the error path — landed in v6.15.
- `git tag --contains 3ef9f710efcb5` confirmed it's in `p-6.15`,
  `p-6.16`, `p-6.17`.
- `git log --oneline v6.18.12` confirmed the buggy commit is present in
  the 6.18.y stable tree.
- `git log --oneline v6.12` confirmed the buggy code is NOT in 6.12 or
  older LTS trees (not applicable for those).
- Verified the error path: loop at line 599 iterates `0..nbase-1`, but
  if allocation fails at index `k`, indices `k+1..nbase-1` have
  uninitialized pointer entries — confirmed in pre-patch code.
- `devm_kfree(NULL)` is safe (no-op) — confirmed by kernel API
  convention.
- The patch is self-contained; no other patches are needed as
  dependencies.

### 8. Conclusion

This commit fixes a real bug: **use of uninitialized memory in the error
path** of `mtk_eint_do_init()`. When memory allocation fails partway
through a loop, the cleanup code passes uninitialized (garbage) pointer
values to `devm_kfree()`, which can trigger `WARN_ON()` in
`devres_destroy()` and potentially cause memory corruption.

The fix is small, surgical (3 `devm_kmalloc` → `devm_kcalloc` changes +
removal of now-redundant NULL checks), well-understood, reviewed by a
maintainer, and carries minimal risk. It only affects the error path —
the successful path is functionally unchanged. The buggy code exists in
stable trees 6.15+.

**YES**

 drivers/pinctrl/mediatek/mtk-eint.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c
index c8c5097c11c4d..2a3c04eedc5f3 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.c
+++ b/drivers/pinctrl/mediatek/mtk-eint.c
@@ -544,24 +544,32 @@ int mtk_eint_do_init(struct mtk_eint *eint, struct mtk_eint_pin *eint_pin)
 		}
 	}
 
-	eint->pin_list = devm_kmalloc(eint->dev, eint->nbase * sizeof(u16 *), GFP_KERNEL);
+	eint->pin_list = devm_kcalloc(eint->dev, eint->nbase,
+				      sizeof(*eint->pin_list), GFP_KERNEL);
 	if (!eint->pin_list)
 		goto err_pin_list;
 
-	eint->wake_mask = devm_kmalloc(eint->dev, eint->nbase * sizeof(u32 *), GFP_KERNEL);
+	eint->wake_mask = devm_kcalloc(eint->dev, eint->nbase,
+				       sizeof(*eint->wake_mask), GFP_KERNEL);
 	if (!eint->wake_mask)
 		goto err_wake_mask;
 
-	eint->cur_mask = devm_kmalloc(eint->dev, eint->nbase * sizeof(u32 *), GFP_KERNEL);
+	eint->cur_mask = devm_kcalloc(eint->dev, eint->nbase,
+				      sizeof(*eint->cur_mask), GFP_KERNEL);
 	if (!eint->cur_mask)
 		goto err_cur_mask;
 
 	for (i = 0; i < eint->nbase; i++) {
-		eint->pin_list[i] = devm_kzalloc(eint->dev, eint->base_pin_num[i] * sizeof(u16),
+		eint->pin_list[i] = devm_kzalloc(eint->dev,
+						 eint->base_pin_num[i] * sizeof(**eint->pin_list),
 						 GFP_KERNEL);
 		port = DIV_ROUND_UP(eint->base_pin_num[i], 32);
-		eint->wake_mask[i] = devm_kzalloc(eint->dev, port * sizeof(u32), GFP_KERNEL);
-		eint->cur_mask[i] = devm_kzalloc(eint->dev, port * sizeof(u32), GFP_KERNEL);
+		eint->wake_mask[i] = devm_kzalloc(eint->dev,
+						  port * sizeof(**eint->wake_mask),
+						  GFP_KERNEL);
+		eint->cur_mask[i] = devm_kzalloc(eint->dev,
+						 port * sizeof(**eint->cur_mask),
+						 GFP_KERNEL);
 		if (!eint->pin_list[i] || !eint->wake_mask[i] || !eint->cur_mask[i])
 			goto err_eint;
 	}
@@ -597,12 +605,9 @@ int mtk_eint_do_init(struct mtk_eint *eint, struct mtk_eint_pin *eint_pin)
 
 err_eint:
 	for (i = 0; i < eint->nbase; i++) {
-		if (eint->cur_mask[i])
-			devm_kfree(eint->dev, eint->cur_mask[i]);
-		if (eint->wake_mask[i])
-			devm_kfree(eint->dev, eint->wake_mask[i]);
-		if (eint->pin_list[i])
-			devm_kfree(eint->dev, eint->pin_list[i]);
+		devm_kfree(eint->dev, eint->cur_mask[i]);
+		devm_kfree(eint->dev, eint->wake_mask[i]);
+		devm_kfree(eint->dev, eint->pin_list[i]);
 	}
 	devm_kfree(eint->dev, eint->cur_mask);
 err_cur_mask:
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH AUTOSEL 6.19-5.10] phy: fsl-imx8mq-usb: disable bind/unbind platform driver feature
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.18] pinctrl: mediatek: make devm allocations safer and clearer in mtk_eint_do_init() Sasha Levin
@ 2026-02-19  2:04 ` Sasha Levin
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.12] dmaengine: stm32-dma3: use module_platform_driver Sasha Levin
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings Sasha Levin
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:04 UTC (permalink / raw)
  To: patches, stable
  Cc: Xu Yang, Frank Li, Vinod Koul, Sasha Levin, linux-phy, imx,
	linux-arm-kernel, linux-kernel

From: Xu Yang <xu.yang_2@nxp.com>

[ Upstream commit 27ee0869d77b2cb404770ac49bdceae3aedf658b ]

Disabling PHYs in runtime usually causes the client with external abort
exception or similar issue due to lack of API to notify clients about PHY
removal. This patch removes the possibility to unbind i.MX PHY drivers in
runtime.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260120111712.3159782-1-xu.yang_2@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Analysis Summary

### What the commit does
This commit adds `.suppress_bind_attrs = true` to the i.MX8MQ USB PHY
platform driver. This single line prevents the kernel from creating
`/sys/bus/platform/drivers/imx8mq-usb-phy/bind` and
`/sys/bus/platform/drivers/imx8mq-usb-phy/unbind` sysfs files, thereby
preventing runtime unbinding of the PHY driver.

### Problem being fixed
The commit message states that unbinding PHYs at runtime causes
"external abort exception or similar issue" because there is no API to
notify PHY clients about PHY removal. An external abort is a serious ARM
exception that typically results in a kernel crash/oops. If a user or
management tool writes to the `unbind` sysfs file for this PHY driver,
the USB controller client would try to access the now-missing PHY
resources, resulting in a crash.

### Stable kernel rules assessment
1. **Obviously correct and tested**: Yes - this is a well-established
   one-line pattern used in 385+ files in the kernel. It's reviewed by
   the PHY maintainer (Vinod Koul) and reviewed by Frank Li.
2. **Fixes a real bug**: Yes - runtime unbinding causes a crash
   (external abort exception). This is a real, triggerable issue.
3. **Important issue**: Moderate - it prevents a crash, but only
   triggered by explicit sysfs manipulation (not normal operation).
   However, system management tools or user error could trigger this.
4. **Small and contained**: Yes - single one-line addition to a driver
   struct.
5. **No new features**: Correct - this removes functionality (ability to
   unbind), it doesn't add any.

### Risk assessment
- **Risk**: Extremely low. This is literally a single boolean field
  being set in the driver struct. It only affects sysfs attributes. The
  same pattern exists in 385+ other drivers.
- **Benefit**: Prevents a crash scenario when the PHY is unbound at
  runtime.
- **Dependencies**: None - this is entirely self-contained.

### Concerns
- The bug is only triggerable by explicit sysfs manipulation (writing to
  `/sys/bus/platform/drivers/imx8mq-usb-phy/unbind`), not by normal
  system operation.
- The fix is a defensive measure rather than fixing a root cause in the
  PHY framework. However, this is the standard kernel approach - the PHY
  framework doesn't have removal notification, so drivers that can't
  handle unbinding should suppress it.
- The change is straightforward and would apply cleanly to any stable
  tree that has this driver.

### Classification
This falls into the **hardware quirk/workaround** category. It's a
defensive fix that prevents a crash scenario. While the trigger requires
explicit user action (sysfs unbind), this is a well-established pattern
in the kernel for exactly this purpose.

## Verification
- Verified `suppress_bind_attrs = true` is used in 385+ files across the
  drivers/ directory via Grep search
- Verified 7 other PHY drivers (Samsung, HiSilicon) already use this
  pattern
- Verified no other Freescale PHY drivers currently have this attribute
  (this is the first)
- Verified via git log that similar commits exist for other subsystems
  (gpio, perf)
- Verified via lore.kernel.org that the patch was reviewed by Frank Li
  and accepted by PHY maintainer Vinod Koul
- Verified the commit message describes a real crash scenario (external
  abort exception)
- Could NOT verify the specific crash reproduction steps (unverified,
  but the mechanism is well-understood in the kernel community)

The fix is minimal (one line), extremely low risk, prevents a crash
scenario, uses a well-established kernel pattern, and was properly
reviewed. It meets all stable kernel criteria.

**YES**

 drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
index 91b3e62743d3a..b30d01f345d20 100644
--- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
+++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
@@ -730,6 +730,7 @@ static struct platform_driver imx8mq_usb_phy_driver = {
 	.driver = {
 		.name	= "imx8mq-usb-phy",
 		.of_match_table	= imx8mq_usb_phy_of_match,
+		.suppress_bind_attrs = true,
 	}
 };
 module_platform_driver(imx8mq_usb_phy_driver);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH AUTOSEL 6.19-6.12] dmaengine: stm32-dma3: use module_platform_driver
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-5.10] phy: fsl-imx8mq-usb: disable bind/unbind platform driver feature Sasha Levin
@ 2026-02-19  2:04 ` Sasha Levin
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings Sasha Levin
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:04 UTC (permalink / raw)
  To: patches, stable
  Cc: Amelie Delaunay, Eugen Hristev, Vinod Koul, Sasha Levin,
	mcoquelin.stm32, alexandre.torgue, dmaengine, linux-stm32,
	linux-arm-kernel, linux-kernel

From: Amelie Delaunay <amelie.delaunay@foss.st.com>

[ Upstream commit 0d41ed4ea496fabbb4dc21171e32d9a924c2a661 ]

Without module_platform_driver(), stm32-dma3 doesn't have a
module_exit procedure. Once stm32-dma3 module is inserted, it
can't be removed, marked busy.
Use module_platform_driver() instead of subsys_initcall() to register
(insmod) and unregister (rmmod) stm32-dma3 driver.

Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20251121-dma3_improv-v2-1-76a207b13ea6@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Interesting - all three STM32 DMA drivers use `subsys_initcall()`. The
other two (stm32-dma and stm32-mdma) also lack module_exit. This commit
only changes stm32-dma3.

## Analysis Summary

### What the commit fixes
The stm32-dma3 driver registers using `subsys_initcall()` but has no
`module_exit()` function. This means the module can be loaded (`insmod`)
but never unloaded (`rmmod`), as the kernel marks it as busy due to
having no exit/cleanup path.

### Change implications
The fix replaces `subsys_initcall()` (priority level 4) with
`module_platform_driver()` which uses `module_init()` /
`device_initcall()` (priority level 6). This is a **behavioral change**
- the driver will now:
1. Initialize later in the boot sequence (device_initcall instead of
   subsys_initcall)
2. Be unloadable via rmmod

### Risk Assessment
- **Positive**: Fixes inability to unload the module - this is a genuine
  bug fix
- **Risk**: The init level change from `subsys_initcall` (level 4) to
  `device_initcall` (level 6) could cause probe ordering issues. DMA
  controllers are often needed early by other subsystems. However, with
  device tree and deferred probing in modern kernels, this should be
  handled. The fact that 54 other DMA drivers use
  `module_platform_driver()` successfully supports this.
- **Scope**: Very small change - removes 6 lines, adds 1 line. Single
  file, single driver.
- **Affected stable trees**: Only 6.11+ (driver introduced in
  v6.11-rc1), so this would apply to v6.12.y and v6.13.y stable trees.

### Stable criteria assessment
- **Fixes a real bug**: Yes - module cannot be unloaded
- **Obviously correct**: Mostly. The `module_platform_driver()` macro is
  the standard pattern used by the majority of DMA drivers. However, the
  init level change adds a small risk.
- **Small and contained**: Yes - 7 lines changed in one file
- **No new features**: The ability to unload a module is restoring
  expected behavior, not a new feature
- **Tested**: Has a Reviewed-by tag from Eugen Hristev

### Concerns
1. The initialization order change (`subsys_initcall` →
   `device_initcall`) is the main concern. DMA engines are
   infrastructure that other drivers depend on. If anything probes
   before the DMA controller is ready and doesn't handle deferred
   probing correctly, this could cause regressions.
2. However, this is mitigated by the fact that modern device tree
   platforms and probe deferral should handle this gracefully.
3. The bug (inability to rmmod) primarily affects development/debugging
   workflows and modular kernel configurations, not production embedded
   systems that typically build DMA drivers in.

## Verification

- **git log** confirmed stm32-dma3.c was introduced by commit
  f561ec8b2b33d, which is in v6.11-rc1
- **Read of current source** (line 1917-1922) confirmed the
  `subsys_initcall` without `module_exit` pattern matches the pre-patch
  state
- **Grep of drivers/dma/stm32/** confirmed all three STM32 DMA drivers
  use subsys_initcall - this commit only changes stm32-dma3
- **Grep of drivers/dma/** found 21 DMA drivers using subsys_initcall
  and 54 using module_platform_driver, confirming module_platform_driver
  is the dominant pattern
- **git tag** confirmed the driver exists only in 6.11+ stable trees
- The `.remove` callback (`stm32_dma3_remove`) is already defined in the
  platform_driver struct (line 1909), confirming the removal path was
  intended to work

## Conclusion

This fixes a real bug (module cannot be unloaded) with a minimal, well-
understood change using a standard kernel macro. The risk is the init
level change, but this follows the pattern of the majority of DMA
drivers. The fix is small, reviewed, and appropriate for stable. The
driver only exists in 6.11+, limiting the scope of backport. For
embedded/STM32 developers who load the DMA3 driver as a module, this is
a meaningful fix.

**YES**

 drivers/dma/stm32/stm32-dma3.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 50e7106c5cb73..9500164c8f688 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -1914,12 +1914,7 @@ static struct platform_driver stm32_dma3_driver = {
 	},
 };
 
-static int __init stm32_dma3_init(void)
-{
-	return platform_driver_register(&stm32_dma3_driver);
-}
-
-subsys_initcall(stm32_dma3_init);
+module_platform_driver(stm32_dma3_driver);
 
 MODULE_DESCRIPTION("STM32 DMA3 controller driver");
 MODULE_AUTHOR("Amelie Delaunay <amelie.delaunay@foss.st.com>");
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH AUTOSEL 6.19-6.1] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings
       [not found] <20260219020422.1539798-1-sashal@kernel.org>
                   ` (4 preceding siblings ...)
  2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.12] dmaengine: stm32-dma3: use module_platform_driver Sasha Levin
@ 2026-02-19  2:04 ` Sasha Levin
  5 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-02-19  2:04 UTC (permalink / raw)
  To: patches, stable
  Cc: Clément Le Goffic, Clément Le Goffic, Amelie Delaunay,
	Vinod Koul, Sasha Levin, mcoquelin.stm32, alexandre.torgue,
	dmaengine, linux-stm32, linux-arm-kernel, linux-kernel

From: Clément Le Goffic <clement.legoffic@foss.st.com>

[ Upstream commit aaf3bc0265744adbc2d364964ef409cf118d193d ]

m2m_hw_period is initialized only when chan_config->m2m_hw is true. This
triggers a warning:
‘m2m_hw_period’ may be used uninitialized [-Wmaybe-uninitialized]
Although m2m_hw_period is only used when chan_config->m2m_hw is true and
ignored otherwise, initialize it unconditionally to 0.

ccr is initialized by stm32_mdma_set_xfer_param() when the sg list is not
empty. This triggers a warning:
‘ccr’ may be used uninitialized [-Wmaybe-uninitialized]
Indeed, it could be used uninitialized if the sg list is empty. Initialize
it to 0.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Reviewed-by: Clément Le Goffic <legoffic.clement@gmail.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20251217-mdma_warnings_fix-v2-1-340200e0bb55@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

I can see `sg_len` is passed from the DMA framework's `prep_slave_sg`
callback. While the DMA framework generally doesn't call this with
`sg_len == 0`, there's no explicit guard against it in this function.
The `stm32_mdma_alloc_desc` with `sg_len == 0` might succeed (allocating
a descriptor with 0 nodes), allowing execution to reach
`stm32_mdma_setup_xfer` with an empty list.

### Verification

- **Read the actual code**: Confirmed `ccr` is used at lines 777-779
  after the for_each_sg loop, and if `sg_len == 0`, `ccr` is never
  initialized by `stm32_mdma_set_xfer_param()`.
- **Caller analysis**: `stm32_mdma_setup_xfer` is called from
  `stm32_mdma_prep_slave_sg` at line 809 with `sg_len` from the DMA
  framework - no explicit guard for `sg_len == 0`.
- **m2m_hw_period**: Confirmed at lines 737-738 and 749-750/758-759 that
  it's only used when `chan_config->m2m_hw` is true (false positive
  warning).
- **Risk assessment**: The change is a trivial initialization, zero
  regression risk.
- **Could NOT verify**: Whether any real-world code path actually passes
  `sg_len == 0` to `prep_slave_sg` (unverified, but defensive
  initialization is correct practice).

### Conclusion

This is a very low-risk fix that:
1. Silences compiler warnings (useful for clean builds)
2. Fixes a real (if potentially rare) uninitialized variable bug for
   `ccr`

The fix is trivially correct, one line, zero regression risk, and fixes
a genuine code correctness issue. While it's borderline because the
primary framing is "fix warnings" and the affected driver is
STM32-specific, the `ccr` uninitialized variable is a real bug that
could cause DMA hardware misconfiguration, and the fix has absolutely no
downside.

**YES**

 drivers/dma/stm32/stm32-mdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
index 080c1c725216c..b87d41b234df1 100644
--- a/drivers/dma/stm32/stm32-mdma.c
+++ b/drivers/dma/stm32/stm32-mdma.c
@@ -731,7 +731,7 @@ static int stm32_mdma_setup_xfer(struct stm32_mdma_chan *chan,
 	struct stm32_mdma_chan_config *chan_config = &chan->chan_config;
 	struct scatterlist *sg;
 	dma_addr_t src_addr, dst_addr;
-	u32 m2m_hw_period, ccr, ctcr, ctbr;
+	u32 m2m_hw_period = 0, ccr = 0, ctcr, ctbr;
 	int i, ret = 0;
 
 	if (chan_config->m2m_hw)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-19  2:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260219020422.1539798-1-sashal@kernel.org>
2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] watchdog: imx7ulp_wdt: handle the nowayout option Sasha Levin
2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: sun6i: Choose appropriate burst length under maxburst Sasha Levin
2026-02-19  2:03 ` [PATCH AUTOSEL 6.19-6.18] pinctrl: mediatek: make devm allocations safer and clearer in mtk_eint_do_init() Sasha Levin
2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-5.10] phy: fsl-imx8mq-usb: disable bind/unbind platform driver feature Sasha Levin
2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.12] dmaengine: stm32-dma3: use module_platform_driver Sasha Levin
2026-02-19  2:04 ` [PATCH AUTOSEL 6.19-6.1] dmaengine: stm32-mdma: initialize m2m_hw_period and ccr to fix warnings Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox