# Re: \[PATCH net v2 1/2\] net: dsa: mt7530: fix NULL dereference on unbind of MT7531 and MT7621

- From: Andrew Lunn \<andrew@lunn.ch\>
- Date: 2026-09-18 01:59:16 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/09/17601386
- Thread: https://ratatoskr.run/netdev/2026/09/17601372/t.md

```text
On Fri, Sep 18, 2026 at 04:50:19AM +0300, Aleksei Sviridkin wrote:
> The core and io supplies are only requested for ID_MT7530: both the
> devm_regulator_get() in probe and the regulator_enable() in
> mt7530_setup() are guarded by the switch id, but mt7530_remove()
> disables them unconditionally. On an MT7621 or an MT7531 both pointers
> are still NULL from devm_kzalloc(), so rmmod or a sysfs unbind calls
> regulator_disable() on NULL.

Did you consider using devm_regulator_get_enable()?

	Andrew
```
