Re: [PATCH net] net: mvneta_bm: fix gen_pool_free address for BPPI

Andrew Lunn <[email protected]>
Newsgroups gmane.linux.network
Message-ID <[email protected]>
> > The cast is ugly, but it also seems correct. However, can the API be
> > improved. If the intention is
> >
> > gen_pool_free(priv->bppi_pool,
> >               gen_pool_dma_alloc(priv->bppi_pool,
> >                                  MVNETA_BM_BPPI_SIZE,
> >                                  &priv->bppi_phys_addr),
> >               MVNETA_BM_BPPI_SIZE);
> >
> > maybe gen_pool_free() should be changed to take a void *?
> >
> >       Andrew
> Thanks for the suggestion.
> 
> The cast is indeed a bit ugly, but several other drivers free memory from
> gen_pool_dma_alloc() in the same way today.

Flip it around. Are there many calls which don't have the cast?

> Changing gen_pool_free()
> itself to take a void * would touch quite a few call sites, including
> ones that use genalloc for non-pointer cookies, so that may be a larger
> change than we want for this fix.

I agree it is more than just the fix here. But this fix is adding yet
another instance where maybe bad design is forcing a cast.

It should also be quite a mechanical change. Can Coccinelle do the
change needed?

	Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.