Re: [PATCH v2 1/2] usb: host: ohci-dbg: use kmalloc() for print buffer

From: Mike Rapoport

Date: Wed Jul 01 2026 - 10:25:37 EST


On Wed, Jul 01, 2026 at 09:52:42AM -0400, Alan Stern wrote:
> On Wed, Jul 01, 2026 at 12:41:50PM +0300, Mike Rapoport (Microsoft) wrote:
> > ochi-dbg allocates buffers for formatting of various dump outputs.
> >
> > These buffers can be allocated with kmalloc() as there's nothing special
> > about them to go directly to the page allocator.
> >
> > kmalloc() provides a better API that does not require ugly casts and
> > kfree() does not need to know the size of the freed object.
> >
> > Performance difference between kmalloc() and __get_free_pages() is not
> > measurable as both allocators take an object/page from a per-CPU list for
> > fast path allocations.
> >
> > For the slow path the performance is anyway determined by the amount of
> > reclaim involved rather than by what allocator is used.
> >
> > Replace use of get_zeroed_page() with kzalloc() and free_page() with
> > kfree().
> >
> > While on it, drop the NULL checks in debug_close(). buf is never NULL
> > here because all the open handlers return -ENOMEM when alloc_buffer()
> > fails, and kfree() can handle a NULL buf->page.
> >
> > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@xxxxxxxxxx
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> > ---
>
> Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Thanks!

> Incidentally, I filtered it out of my reply this time, but on this and
> previous submissions you have a CC: entry that says <rpppt@xxxxxxxxxx>,
> which is an invalid address (three 'p's instead of two). Is there a
> typo in one of your scripts or settings? It's a little surprising that
> you aren't constantly getting email error messages every time you send
> something out.

I'm gradually switching to b4 send and this looks like off-by-one in my
manual editing of the addresses.

> Alan Stern

--
Sincerely yours,
Mike.