lwfinger / rtl8723bu

Driver for RTL8723BU
284 stars 144 forks source link

initialize le_tmp and le_tmp2 correctly, fixes WPA2 connections problems #15

Closed puchu closed 8 years ago

puchu commented 8 years ago

Signed-off-by: puchu puchu@gmx.at

lwfinger commented 8 years ago

Those variables do not need to be initialized to zero. Variable le_tmp is set in both branches of the "if (CmdLen <= 3)" statement. Variable le_tmp2 is only used when CmdLen > 3, and it is set when that condition holds.

With the versions of gcc that I use, there is no warning. That includes "gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]" on my x86_64 laptop, and "gcc 4.6.3" on my PowerBook G4 that I am using for big-endian testing. Obviously, you are getting a warning with your version of gcc. I try not to initialize variables unless there is a path in which the variable may be used without being set. Initializing a variable to cover a false positive such as you are finding prevents the detection of a real error that might be introduced in future edits. For that reason, I will not be incorporating this change.

Please try the attached patch. It should eliminate your warnings, and it makes the code a bit cleaner.

rework_set_h2c_cmd.txt

puchu commented 8 years ago

as i can see on your latest commit, the initialization to zero is needed, works fine now - thanks for this great driver :)

btw i didn't get compiler warnings the code stopped working and i tried to find the cause of it