linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Hahn <pmhahn@pmhahn.de>
To: Salah Triki <salah.triki@gmail.com>,
	fabrice.gasnier@foss.st.com, thierry.reding@gmail.com,
	u.kleine-koenig@pengutronix.de, lee.jones@linaro.org,
	mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com
Cc: linux-pwm@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] divide by 3*sizeof(u32) when computing array_size
Date: Tue, 13 Jul 2021 08:02:26 +0200	[thread overview]
Message-ID: <e597d6b8-55d6-2fa6-5f79-86ff813d8bd2@pmhahn.de> (raw)
In-Reply-To: <20210712231910.GA1831270@pc>

Hello,

Disclaimer: I have no idea what 'pwm-stm32' is or does

Am 13.07.21 um 01:19 schrieb Salah Triki:
> Divide by 3*sizeof(u32) when computing array_size, since stm32_breakinput
> has 3 fields of type u32.
...
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -544,7 +544,7 @@ static int stm32_pwm_probe_breakinputs(struct stm32_pwm *priv,
>   		return -EINVAL;
>   
>   	priv->num_breakinputs = nb;
> -	array_size = nb * sizeof(struct stm32_breakinput) / sizeof(u32);
> +	array_size = nb * sizeof(struct stm32_breakinput) / (3 * sizeof(u32));

Maybe it's too early in the morning for me, but this does not look right:

> struct stm32_breakinput {
> 	u32 index;
> 	u32 level;
> 	u32 filter;
> };

then "sizeof(struct stm32_breakinput)" == "(3 * sizeof(u32))", which 
would simply make "arrray_site := nb" ?

Philipp

  reply	other threads:[~2021-07-13  6:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 23:19 [PATCH] divide by 3*sizeof(u32) when computing array_size Salah Triki
2021-07-13  6:02 ` Philipp Hahn [this message]
2021-07-13  6:30 ` Uwe Kleine-König
2021-07-13  9:07   ` Uwe Kleine-König
2021-07-13  9:19   ` Russell King (Oracle)
2021-07-13 11:07     ` David Laight
2021-07-13 11:22       ` Russell King (Oracle)
2021-07-13 12:20         ` David Laight
2021-07-13 12:35           ` Russell King (Oracle)

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=e597d6b8-55d6-2fa6-5f79-86ff813d8bd2@pmhahn.de \
    --to=pmhahn@pmhahn.de \
    --cc=alexandre.torgue@foss.st.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=salah.triki@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).