diff mbox series

[03/10] arm: stm32mp: bsec: remove unneeded test

Message ID 20200212183744.5309-4-patrick.delaunay@st.com
State Accepted
Commit df2d1b8fc472bd0c7ec20d86337d437241d9b013
Delegated to: Patrick Delaunay
Headers show
Series stm32mp1: board and SOC identifications | expand

Commit Message

Patrick DELAUNAY Feb. 12, 2020, 6:37 p.m. UTC
Remove the test offs < 0 , as offs is unsigned.

This patch solves the warnings when compiling with W=1
on stm32mp1 board:

In function ‘stm32mp_bsec_read’:
arch/arm/mach-stm32mp/bsec.c:368:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  368 |  if (offs < 0 || (offs % 4) || (size % 4))
      |           ^
In function ‘stm32mp_bsec_write’:
arch/arm/mach-stm32mp/bsec.c:405:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  405 |  if (offs < 0 || (offs % 4) || (size % 4))
      |           ^

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 arch/arm/mach-stm32mp/bsec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Patrice CHOTARD March 18, 2020, 10:04 a.m. UTC | #1
On 2/12/20 7:37 PM, Patrick Delaunay wrote:
> Remove the test offs < 0 , as offs is unsigned.
>
> This patch solves the warnings when compiling with W=1
> on stm32mp1 board:
>
> In function ‘stm32mp_bsec_read’:
> arch/arm/mach-stm32mp/bsec.c:368:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   368 |  if (offs < 0 || (offs % 4) || (size % 4))
>       |           ^
> In function ‘stm32mp_bsec_write’:
> arch/arm/mach-stm32mp/bsec.c:405:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   405 |  if (offs < 0 || (offs % 4) || (size % 4))
>       |           ^
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  arch/arm/mach-stm32mp/bsec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
> index a77c706a1a..1d904caae1 100644
> --- a/arch/arm/mach-stm32mp/bsec.c
> +++ b/arch/arm/mach-stm32mp/bsec.c
> @@ -365,7 +365,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset,
>  		shadow = false;
>  	}
>  
> -	if (offs < 0 || (offs % 4) || (size % 4))
> +	if ((offs % 4) || (size % 4))
>  		return -EINVAL;
>  
>  	otp = offs / sizeof(u32);
> @@ -402,7 +402,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
>  		shadow = false;
>  	}
>  
> -	if (offs < 0 || (offs % 4) || (size % 4))
> +	if ((offs % 4) || (size % 4))
>  		return -EINVAL;
>  
>  	otp = offs / sizeof(u32);

Acked-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

Patrice
Patrick DELAUNAY March 24, 2020, 8:34 a.m. UTC | #2
Hi,

> From: Patrick DELAUNAY <patrick.delaunay@st.com>
> Sent: mercredi 12 février 2020 19:38
> 
> Remove the test offs < 0 , as offs is unsigned.
> 
> This patch solves the warnings when compiling with W=1 on stm32mp1 board:
> 
> In function ‘stm32mp_bsec_read’:
> arch/arm/mach-stm32mp/bsec.c:368:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   368 |  if (offs < 0 || (offs % 4) || (size % 4))
>       |           ^
> In function ‘stm32mp_bsec_write’:
> arch/arm/mach-stm32mp/bsec.c:405:11: warning:
> comparison of unsigned expression < 0 is always false [-Wtype-limits]
>   405 |  if (offs < 0 || (offs % 4) || (size % 4))
>       |           ^
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---

Applied to u-boot-stm/next, thanks!

Regards

Patrick
Patrick DELAUNAY April 24, 2020, 2:24 p.m. UTC | #3
Hi

> From: Patrice CHOTARD <patrice.chotard@st.com>
> Sent: mercredi 18 mars 2020 11:05
> 
> 
> On 2/12/20 7:37 PM, Patrick Delaunay wrote:
> > Remove the test offs < 0 , as offs is unsigned.
> >
> > This patch solves the warnings when compiling with W=1 on stm32mp1
> > board:
> >
> > In function ‘stm32mp_bsec_read’:
> > arch/arm/mach-stm32mp/bsec.c:368:11: warning:
> > comparison of unsigned expression < 0 is always false [-Wtype-limits]
> >   368 |  if (offs < 0 || (offs % 4) || (size % 4))
> >       |           ^
> > In function ‘stm32mp_bsec_write’:
> > arch/arm/mach-stm32mp/bsec.c:405:11: warning:
> > comparison of unsigned expression < 0 is always false [-Wtype-limits]
> >   405 |  if (offs < 0 || (offs % 4) || (size % 4))
> >       |           ^
> >
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> >
> >  arch/arm/mach-stm32mp/bsec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >

Applied to u-boot-stm/master, thanks!

Regards

Patrick
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
index a77c706a1a..1d904caae1 100644
--- a/arch/arm/mach-stm32mp/bsec.c
+++ b/arch/arm/mach-stm32mp/bsec.c
@@ -365,7 +365,7 @@  static int stm32mp_bsec_read(struct udevice *dev, int offset,
 		shadow = false;
 	}
 
-	if (offs < 0 || (offs % 4) || (size % 4))
+	if ((offs % 4) || (size % 4))
 		return -EINVAL;
 
 	otp = offs / sizeof(u32);
@@ -402,7 +402,7 @@  static int stm32mp_bsec_write(struct udevice *dev, int offset,
 		shadow = false;
 	}
 
-	if (offs < 0 || (offs % 4) || (size % 4))
+	if ((offs % 4) || (size % 4))
 		return -EINVAL;
 
 	otp = offs / sizeof(u32);