]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: bluetooth: initialize rfc struct in l2cap_core.c
authorSimon Que <sque@chromium.org>
Thu, 17 Jan 2013 00:19:26 +0000 (16:19 -0800)
committerChromeBot <chrome-bot@google.com>
Thu, 17 Jan 2013 22:45:23 +0000 (14:45 -0800)
Removes warnings:
warning: 'rfc.max_pdu_size' may be used uninitialized in this function
warning: 'rfc.monitor_timeout' may be used uninitialized in this function
warning: 'rfc.retrans_timeout' may be used uninitialized in this function
warning: 'rfc.mode' may be used uninitialized in this function

This is based on (but not compatible with) an upstream patch:
c20f8e35ca8b0583323d310ec63a0f0d17cfdcf5

This patch can be discarded when moving to kernel-next

BUG=chromium-os:5542
TEST=emerge chromeos-kernel, make sure l2cap_core has no warnings

Change-Id: I564eca4421a6c4f8f4dcddfacd56e0d574885596
Signed-off-by: Simon Que <sque@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41481
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
net/bluetooth/l2cap_core.c

index 6f9c25b633a604ce35824a8b466186df6ddb25c3..41f4cd384339c665c8983c80b7adb1b32087db5b 100644 (file)
@@ -2573,7 +2573,15 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)
 {
        int type, olen;
        unsigned long val;
-       struct l2cap_conf_rfc rfc;
+       /* Initialize to sane default values in case a misbehaving remote device
+        * does not send an RFC option later.
+        */
+       struct l2cap_conf_rfc rfc = {
+               .mode = chan->mode,
+               .retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO),
+               .monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO),
+               .max_pdu_size = cpu_to_le16(chan->imtu),
+       };
 
        BT_DBG("chan %p, rsp %p, len %d", chan, rsp, len);
 
@@ -2591,14 +2599,6 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)
                }
        }
 
-       /* Use sane default values in case a misbehaving remote device
-        * did not send an RFC option.
-        */
-       rfc.mode = chan->mode;
-       rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO);
-       rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO);
-       rfc.max_pdu_size = cpu_to_le16(chan->imtu);
-
        BT_ERR("Expected RFC option was not found, using defaults");
 
 done: