On 06/09/15 17:26, Nicolas Morey-Chaisemartin wrote:
Also adds a check of sscanf return value to make checkpatch happy

Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]>
---
  example/classifier/odp_classifier.c | 6 ++++--
  example/timer/odp_timer_test.c      | 3 ++-
  2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 48fc1ab..5413984 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -171,9 +171,11 @@ static inline
  int parse_ipv4_mask(const char *str, uint32_t *mask)
  {
        uint32_t b;
-       sscanf(str, "%x", &b);
+       int ret;
+
+       ret = sscanf(str, "%" PRIx32, &b);

SCNx32?

http://patchwork.ozlabs.org/patch/339888/

        *mask = b;
-       return 0;
+       return ret != 1;
  }
/**
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 4f4c798..3ac4fe1 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -182,7 +182,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls)
                if (!odp_timeout_fresh(tmo)) {
                        /* Not the expected expiration tick, timer has
                         * been reset or cancelled or freed */
-                       EXAMPLE_ABORT("Unexpected timeout received (timer %x, tick 
%"PRIu64")\n",
+                       EXAMPLE_ABORT("Unexpected timeout received (timer %"
+                                     PRIx32 ", tick %" PRIu64 ")\n",
I would note on that line splitting also. Please do not split format %" PRIx32 " on 2 lines. You have enough room on first line to put it and more easy to read that. Strange that checkpatch allows to do that.

Maxim.
                                      ttp->tim, tick);
                }
                EXAMPLE_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to