Re: [PATCH] mmc: core: remove unnecessary (void*) conversions
From: Ulf Hansson
Date: Mon Mar 27 2023 - 06:27:53 EST
On Fri, 24 Mar 2023 at 17:39, Dan Carpenter <error27@xxxxxxxxx> wrote:
>
> On Fri, Mar 24, 2023 at 02:28:57PM +0100, Marek Szyprowski wrote:
> > On 17.03.2023 07:47, Yu Zhe wrote:
> > > Pointer variables of void * type do not require type cast.
> > >
> > > Signed-off-by: Yu Zhe <yuzhe@xxxxxxxxxxxx>
> > > ---
> > > drivers/mmc/core/debugfs.c | 2 +-
> > > drivers/mmc/core/host.c | 2 +-
> > > drivers/mmc/core/mmc_test.c | 6 +++---
> > > 3 files changed, 5 insertions(+), 5 deletions(-)
> > ...
> > > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > > index 096093f7be00..76900f67c782 100644
> > > --- a/drivers/mmc/core/host.c
> > > +++ b/drivers/mmc/core/host.c
> > > @@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
> > >
> > > static void devm_mmc_host_release(struct device *dev, void *res)
> > > {
> > > - mmc_free_host(*(struct mmc_host **)res);
> > > + mmc_free_host(res);
> >
> > The above chunk is wrong and causes following regression on today's
> > Linux next-20230324:
>
> Ugh...
>
> Ok. I have a script that I use to help review mechanical patches. I
> have added an '-r cast' option to help review "remove unnecessary cast"
> patches.
>
> If you do `cat this_email.txt | rename_rev.pl -r cast` then the output
> looks like:
>
> ================
> static void devm_mmc_host_release(struct device *dev, void *res)
> {
> - mmc_free_host(*res);
> + mmc_free_host(res);
> }
>
> struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
> ================
>
> I have gone through all of Yu Zhe's patches and the rest are okay.
>
> I've attached my rename_rev.pl script.
Thanks for helping out Dan! I will use your script next time!
Kind regards
Uffe