On Thu, Jul 23, 2026 at 12:26:41PM -0700, Rosen Penev wrote: > On Thu, Jul 23, 2026 at 12:53 AM Stanislaw Gruszka <[email protected]> wrote: > > > > Hi, > > > > On Sun, Jun 28, 2026 at 08:31:56PM -0700, Rosen Penev wrote: > > > struct hw_mode_spec stores channel information that is allocated by the > > > individual rt2x00 drivers during hardware probing. The channel info > > > array has the same lifetime as the hardware mode specification, but it > > > is currently allocated separately and then freed through a separate > > > pointer. > > > > > > Make struct rt2x00_dev hold a pointer to the hardware mode > > > specification, store the channel info as a flexible array member, and > > > allocate both pieces together with kzalloc_flex(). > > > > > > Assisted-by: Codex:GPT-5.5 > > > Signed-off-by: Rosen Penev <[email protected]> > > > --- > > > .../net/wireless/ralink/rt2x00/rt2400pci.c | 24 +++--- > > > .../net/wireless/ralink/rt2x00/rt2500pci.c | 55 ++++++++------ > > > .../net/wireless/ralink/rt2x00/rt2500usb.c | 55 ++++++++------ > > > .../net/wireless/ralink/rt2x00/rt2800lib.c | 74 ++++++++++--------- > > > drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 +- > > > .../net/wireless/ralink/rt2x00/rt2x00config.c | 12 +-- > > > .../net/wireless/ralink/rt2x00/rt2x00dev.c | 4 +- > > > drivers/net/wireless/ralink/rt2x00/rt61pci.c | 42 ++++++----- > > > drivers/net/wireless/ralink/rt2x00/rt73usb.c | 50 +++++++------ > > > 9 files changed, 177 insertions(+), 143 deletions(-) > > > > This result in extra code. I do not see benefit of avoiding > > kzalloc calls at cost of adding more lines of code. > On runtime there's extra UBSAN analysis. Reducing allocations is always good.
No, not always. Sanitizes are for catching bugs, not for performance. Adding complexity to the driver to run faster with them is not good idea. Also, this is on initialization path, which done usually once per system boot, so visible gains will be something between zero an non-existing. Regards Stanislaw

