All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: "Maxime Ripard" <mripard@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Clément Péron" <peron.clem@gmail.com>,
	linux-pwm@vger.kernel.org
Subject: Re: [PATCH] pwm: sun4i: Initialize variables before use
Date: Mon, 20 Jan 2020 21:09:17 +0100	[thread overview]
Message-ID: <20200120200917.gvua5h2egoznwd4h@pengutronix.de> (raw)
In-Reply-To: <20200120143206.710666-1-thierry.reding@gmail.com>

Hello Thierry,

On Mon, Jan 20, 2020 at 03:32:06PM +0100, Thierry Reding wrote:
> GCC can't always determine that the duty, period and prescaler values
> are initialized when returning from sun4i_pwm_calculate(), so help out a
> little by initializing them to 0.

Is it worth mentioning the gcc version you're using?

> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  drivers/pwm/pwm-sun4i.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 0decc7cde133..3e3efa6c768f 100644

I don't find this object (0decc7cde133) in my tree or next. Which
version is this?

> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -234,9 +234,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  {
>  	struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip);
>  	struct pwm_state cstate;
> -	u32 ctrl, duty, period, val;
> +	u32 ctrl, duty = 0, period = 0, val;

+     u32 ctrl, uninitialized_var(duty), uninitialized_var(period), val;

should fix the warnings, too, and additionally explicitly documents that
it's just the compiler that doesn't see there is no problem.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

  reply	other threads:[~2020-01-20 20:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 14:32 [PATCH] pwm: sun4i: Initialize variables before use Thierry Reding
2020-01-20 20:09 ` Uwe Kleine-König [this message]
2020-01-20 20:23   ` Clément Péron
2020-01-21 13:50   ` Thierry Reding
2020-01-21 14:31     ` Uwe Kleine-König

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=20200120200917.gvua5h2egoznwd4h@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=peron.clem@gmail.com \
    --cc=thierry.reding@gmail.com \
    /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.