mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] i.MX: HABv4: use min_t instead of min
@ 2019-06-25  7:31 Rouven Czerwinski
  2019-06-25  7:31 ` [PATCH 2/2] i.MX: HABv4: Reset index variable after error type Rouven Czerwinski
  2019-06-26  7:03 ` [PATCH 1/2] i.MX: HABv4: use min_t instead of min Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Rouven Czerwinski @ 2019-06-25  7:31 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

This fixes a compiler warning because len is size_t and
RNG_FAIL_EVENT_SIZE was cast to uint32_t.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/hab/habv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 496fbe3ccd..2e3e349b0b 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -419,7 +419,7 @@ static bool is_known_rng_fail_event(const uint8_t *data, size_t len)
 	int i;
 	for (i = 0; i < ARRAY_SIZE(habv4_known_rng_fail_events); i++) {
 		if (memcmp(data, habv4_known_rng_fail_events[i],
-			   min(len, (uint32_t)RNG_FAIL_EVENT_SIZE)) == 0) {
+			   min_t(size_t, len, RNG_FAIL_EVENT_SIZE)) == 0) {
 			return true;
 		}
 	}
-- 
2.22.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] i.MX: HABv4: Reset index variable after error type
  2019-06-25  7:31 [PATCH 1/2] i.MX: HABv4: use min_t instead of min Rouven Czerwinski
@ 2019-06-25  7:31 ` Rouven Czerwinski
  2019-06-26  7:03 ` [PATCH 1/2] i.MX: HABv4: use min_t instead of min Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Rouven Czerwinski @ 2019-06-25  7:31 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

The index variable is used for each error type, it should be reset to 0
before retrieving the next error status, otherwise error messages are
skipped if the preceding error type incremented index.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/hab/habv4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 2e3e349b0b..6a60be6853 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -469,6 +469,7 @@ static int habv4_get_status(const struct habv4_rvt *rvt)
 	}
 
 	len = sizeof(data);
+	index = 0;
 	while (rvt->report_event(HAB_STATUS_FAILURE, index, data, &len) == HAB_STATUS_SUCCESS) {
 		pr_err("-------- HAB failure Event %d --------\n", index);
 		pr_err("event data:\n");
@@ -480,6 +481,7 @@ static int habv4_get_status(const struct habv4_rvt *rvt)
 
 	/* Check reason for stopping */
 	len = sizeof(data);
+	index = 0;
 	if (rvt->report_event(HAB_STATUS_ANY, index, NULL, &len) == HAB_STATUS_SUCCESS)
 		pr_err("ERROR: Recompile with larger event data buffer (at least %d bytes)\n\n", len);
 
-- 
2.22.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] i.MX: HABv4: use min_t instead of min
  2019-06-25  7:31 [PATCH 1/2] i.MX: HABv4: use min_t instead of min Rouven Czerwinski
  2019-06-25  7:31 ` [PATCH 2/2] i.MX: HABv4: Reset index variable after error type Rouven Czerwinski
@ 2019-06-26  7:03 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-06-26  7:03 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Tue, Jun 25, 2019 at 09:31:45AM +0200, Rouven Czerwinski wrote:
> This fixes a compiler warning because len is size_t and
> RNG_FAIL_EVENT_SIZE was cast to uint32_t.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  drivers/hab/habv4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
> index 496fbe3ccd..2e3e349b0b 100644
> --- a/drivers/hab/habv4.c
> +++ b/drivers/hab/habv4.c
> @@ -419,7 +419,7 @@ static bool is_known_rng_fail_event(const uint8_t *data, size_t len)
>  	int i;
>  	for (i = 0; i < ARRAY_SIZE(habv4_known_rng_fail_events); i++) {
>  		if (memcmp(data, habv4_known_rng_fail_events[i],
> -			   min(len, (uint32_t)RNG_FAIL_EVENT_SIZE)) == 0) {
> +			   min_t(size_t, len, RNG_FAIL_EVENT_SIZE)) == 0) {
>  			return true;
>  		}
>  	}
> -- 
> 2.22.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-26  7:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25  7:31 [PATCH 1/2] i.MX: HABv4: use min_t instead of min Rouven Czerwinski
2019-06-25  7:31 ` [PATCH 2/2] i.MX: HABv4: Reset index variable after error type Rouven Czerwinski
2019-06-26  7:03 ` [PATCH 1/2] i.MX: HABv4: use min_t instead of min Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox