Re: [PATCH wireless-next] wifi: rt2x00: Use device-managed register buffers
From: Stanislaw Gruszka
Date: Thu Jul 23 2026 - 04:34:23 EST
On Fri, Jul 17, 2026 at 03:00:52PM -0700, Rosen Penev wrote:
> The rt2x00 PCI and USB probe paths allocate EEPROM and RF storage with
> plain kzalloc() and then free it from bus-specific teardown helpers. The
> USB path also manages the CSR cache the same way. These buffers are
> tied to the device lifetime, so the explicit free paths add probe and
> disconnect cleanup without providing separate ownership.
>
> Allocate the buffers with devm_kzalloc() before the mac80211 hardware is
> allocated, then attach the resulting storage to struct rt2x00_dev after
> the driver-private state exists. This lets driver detach and probe
> failure rely on device-managed cleanup and removes the duplicated
> bus-specific buffer freeing.
>
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
Acked-by: Stanislaw Gruszka <stf_xl@xxxxx>
> int rt2x00usb_probe(struct usb_interface *usb_intf,
> const struct rt2x00_ops *ops)
> {
> struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
> - struct ieee80211_hw *hw;
> struct rt2x00_dev *rt2x00dev;
> + struct ieee80211_hw *hw;
> + __le16 *eeprom;
> + void *cache;
> int retval;
> + u32* rf;
Nit, u32 *rf;
Regards
Stanislaw