Re: [MM][PATCH] remove comparison of unsigned expression >= 0



On 27/04/13 07:29, Yunlian Jiang wrote:
This patch removes a few unnecessary checks of unsigned expression >= 0,
which also fixes the following clang warnings:

Patch doesn't seem to be cleanly applicable with "git am". How did you
create it? Please use either git send-email or git format-patch.



mm-broadband-bearer.c:1511:31: error: comparison of unsigned expression >= 0 is always true 
[-Werror,-Wtautological-compare]
    ctx->cgact_command = (cid >= 0 ?
                          ~~~ ^  ~
1 error generated.

mm-broadband-modem.c:1647:17: error: comparison of unsigned expression >= 0 is always true 
[-Werror,-Wtautological-compare]
        quality >= 0) {
        ~~~~~~~ ^  ~

sierra/mm-broadband-modem-sierra.c:570:18: error: comparison of unsigned expression >= 0 is always true 
[-Werror,-Wtautological-compare]
            mode >= 0 &&
            ~~~~ ^  ~

Bug reported on https://code.google.com/p/chromium/issues/detail?id=235989

---

diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index 301f41e..affc01f 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -567,7 +567,6 @@ selrat_query_ready (MMBaseModem *self,
         guint mode;
 
         if (mm_get_uint_from_match_info (match_info, 1, &mode) &&
-            mode >= 0 &&
             mode <= 7) {
             switch (mode) {
             case 0:
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index 292420c..fcaad56 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -1508,9 +1508,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
                                            user_data);
 
     /* If no specific CID was used, disable all PDP contexts */
-    ctx->cgact_command = (cid >= 0 ?
-                          g_strdup_printf ("+CGACT=0,%d", cid) :
-                          g_strdup_printf ("+CGACT=0"));
+    ctx->cgact_command = g_strdup_printf ("+CGACT=0,%d", cid);
 
     /* If the primary port is NOT connected (doesn't have to be the data port),
      * we'll send CGACT there */
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 92b2050..bfca363 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -1643,8 +1643,7 @@ normalize_ciev_cind_signal_quality (guint quality,
                                     guint min,
                                     guint max)
 {
-    if (!max &&
-        quality >= 0) {
+    if (!max) {
         /* If we didn't get a max, assume it was 5. Note that we do allow
          * 0, meaning no signal at all. */
         return (quality * 20);
--

1.8.2.1



_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list



-- 
Aleksander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]