[Drbd-dev] [DRBD-user] [PATCH 1/6] block: Remove unneeded variable err for returning 0

Roland Kammerer roland.kammerer at linbit.com
Wed Oct 28 10:17:31 CET 2015


On Wed, Oct 28, 2015 at 12:41:28AM +0530, punit vara wrote:
> On Mon, Oct 26, 2015 at 12:18 AM, Punit Vara <punitvara at gmail.com> wrote:
> > This patch is to the mg_disk.c file that removes unnecessary err
> > and fixes  following warning reported by coccicheck:
> >
> > Unneeded variable: "err". Return "0" on line 1077
> >
> > Signed-off-by: Punit Vara <punitvara at gmail.com>
> > ---
> >  drivers/block/mg_disk.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
> > index 145ce2a..d6f3feb 100644
> > --- a/drivers/block/mg_disk.c
> > +++ b/drivers/block/mg_disk.c
> > @@ -1038,7 +1038,6 @@ static int mg_remove(struct platform_device *plat_dev)
> >  {
> >         struct mg_drv_data *prv_data = plat_dev->dev.platform_data;
> >         struct mg_host *host = prv_data->host;
> > -       int err = 0;
> >
> >         /* delete timer */
> >         del_timer_sync(&host->timer);
> > @@ -1074,7 +1073,7 @@ static int mg_remove(struct platform_device *plat_dev)
> >         /* free mg_host */
> >         kfree(host);
> >
> > -       return err;
> > +       return 0;
> >  }
> >
> >  static struct platform_driver mg_disk_driver = {
> > --
> > 2.5.3
> >
> Anybody going to review this patches please and I dont know who is
> maintainer for all these patches

Hi,

hm, so if it always returns the same value, why not make the function
"void" and change the call sites? The compiler optimizes it anyways,
this does not save anything.

Like the rest of your patch set, it does not really improve anything.
These style/whitespace fixes will happen anyways when someone is
actually working on the _code_...

So thank you for your input, valid points, but as long as there is a
single item on my todo-list, I - again highly personal view - don't care
about whitespace patches.

Regards, rck


More information about the drbd-dev mailing list