Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d7d080e9f7cd535a8821efd3835c5cfa5223ab6
Commit:     6d7d080e9f7cd535a8821efd3835c5cfa5223ab6
Parent:     454a01e7f486279b0bf8979d94203ab7a503e053
Author:     Roland Dreier <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 19:30:51 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 19:30:51 2007 -0700

    IB/mthca: Use uninitialized_var() for f0
    
    Commit 9db48926 ("drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd
    var warning") added "= 0" to the declarations of f0 to shut up gcc
    warnings.  However, there's no point in making the code bigger by
    initializing f0 to a random value just to get rid of a warning;
    setting f0 to 0 is no safer than just using uninitialized_var(), which
    documents the situation better and gives smaller code too.  For example,
    on x86_64:
    
    add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16 (-16)
    function                                     old     new   delta
    mthca_tavor_post_send                       1352    1344      -8
    mthca_arbel_post_send                       1489    1481      -8
    
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_qp.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c 
b/drivers/infiniband/hw/mthca/mthca_qp.c
index 11f1d99..0e9ef24 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1591,7 +1591,13 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       u32 f0 = 0;
+       /*
+        * f0 is only used if nreq != 0, and f0 will be initialized
+        * the first time through the main loop, since size0 == 0 the
+        * first time through.  So nreq cannot become non-zero without
+        * initializing f0, and f0 is in fact never used uninitialized.
+        */
+       u32 uninitialized_var(f0);
        int ind;
        u8 op0 = 0;
 
@@ -1946,7 +1952,13 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       u32 f0 = 0;
+       /*
+        * f0 is only used if nreq != 0, and f0 will be initialized
+        * the first time through the main loop, since size0 == 0 the
+        * first time through.  So nreq cannot become non-zero without
+        * initializing f0, and f0 is in fact never used uninitialized.
+        */
+       u32 uninitialized_var(f0);
        int ind;
        u8 op0 = 0;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to