]> git.baikalelectronics.ru Git - kernel.git/commit
staging:rtl8192u: Change struct r8192_priv member Rf_Mode from u8 > enum
authorJohn Whitmore <johnfwhitmore@gmail.com>
Wed, 11 Jul 2018 19:21:49 +0000 (20:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Jul 2018 09:40:46 +0000 (11:40 +0200)
commit1da6dd17ae6d9c1a1a03239880d5ffdfaf6e247a
treea2339657ce7151cf24975d0d8f4614ddf81b25bd
parent1ce44d67d8cfb8389ad255fb4c18636b8d768ab4
staging:rtl8192u: Change struct r8192_priv member Rf_Mode from u8 > enum

The file r8192U.h defines the structure for holding private data for the
driver (typedef struct r8192_priv). This structure includes a member Rf_Mode
which is defined to be of type "u8".

Whilst the variable Rf_Mode is defined to be of type "u8" it is being assigned
enumerated values defined by the enumerated type "enum rf_op_type". Because of
the mismatch in types being used any advantage of using an enumerated type, to
have the compiler check assignments, is nullified.

This patch changes the type of the Rf_Mode member from a u8 to the enumerated
type "enum rf_op_type", so that the compiler can now check assignments.

This change of type would cause a problem if the structure was mapped from a
hardware device and the size and location of members was significant. I
believe that the structure to hold private data for the driver is allocated
from memory and populated with data in the function rtl8192_usb_probe() in the
file r8192U_core.c. As such the physical size of the member variable Rf_Mode
is not significant, so the change should have no impact on code execution, bar
the move from a u8 type to an int, (or whatever size compiler uses for enum).

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/r8192U.h