All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: linux-media@vger.kernel.org, g.liakhovetski@gmx.de
Subject: Re: [PATCH 1/5] mt9m111: set inital return values to zero
Date: Thu, 14 Jul 2011 17:25:20 +0200	[thread overview]
Message-ID: <201107141725.21401.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1310485146-27759-1-git-send-email-m.grzeschik@pengutronix.de>

Hi Michael,

There's no need to set initial return values to zero if they're assigned to in 
all code paths.

[snip]

> *client) static int mt9m111_enable(struct i2c_client *client)
>  {
>  	struct mt9m111 *mt9m111 = to_mt9m111(client);
> -	int ret;
> +	int ret = 0;
> 
>  	ret = reg_set(RESET, MT9M111_RESET_CHIP_ENABLE);
>  	if (!ret)

This is a clear example, ret will never be used uninitialized. Initializing it 
to 0 would be a waste of resources (although in this case it will probably be 
optimized out by the compiler).

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2011-07-14 15:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 15:39 [PATCH 1/5] mt9m111: set inital return values to zero Michael Grzeschik
2011-07-12 15:39 ` [PATCH 2/5] mt9m111: fix missing return value check mt9m111_reg_clear Michael Grzeschik
2011-07-17 16:54   ` Guennadi Liakhovetski
2011-07-12 15:39 ` [PATCH 3/5] mt9m111: move lastpage to struct mt9m111 for multi instances Michael Grzeschik
2011-07-14 15:27   ` Laurent Pinchart
2011-07-17 16:53     ` Guennadi Liakhovetski
2011-07-19 13:26   ` [PATCH v2] " Michael Grzeschik
2011-07-19 14:10     ` Guennadi Liakhovetski
2011-07-12 15:39 ` [PATCH v4 4/5] mt9m111: rewrite set_pixfmt Michael Grzeschik
2011-07-17 17:09   ` Guennadi Liakhovetski
2011-07-22 11:57     ` Michael Grzeschik
2011-07-12 15:39 ` [PATCH 5/5] mt9m111: make use of testpattern Michael Grzeschik
2011-07-17 16:55   ` Guennadi Liakhovetski
2011-07-14 15:25 ` Laurent Pinchart [this message]
2011-07-17 16:52   ` [PATCH 1/5] mt9m111: set inital return values to zero Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107141725.21401.laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.