Skip to content

Commit

Permalink
hwmon : (applesmc) Fix uninitialized variables warnings
Browse files Browse the repository at this point in the history
Fix the following "maybe used uninitialized" warnings by
initializing the variables to keep the compiler quiet.
There is no "used uninitialized" in this case.

  CC [M]  drivers/hwmon/applesmc.o
drivers/hwmon/applesmc.c: In function ‘applesmc_init_smcreg’:
drivers/hwmon/applesmc.c:595:43: warning: ‘right_light_sensor’
may be used uninitialized in this function [-Wmaybe-uninitialized]
  s->num_light_sensors = left_light_sensor + right_light_sensor;
                                           ^
drivers/hwmon/applesmc.c:540:26: note: ‘right_light_sensor’ was
declared here
  bool left_light_sensor, right_light_sensor;
                          ^
drivers/hwmon/applesmc.c:595:43: warning: ‘left_light_sensor’ may
be used uninitialized in this function [-Wmaybe-uninitialized]
  s->num_light_sensors = left_light_sensor + right_light_sensor;
                                           ^
drivers/hwmon/applesmc.c:540:7: note: ‘left_light_sensor’ was
declared here
  bool left_light_sensor, right_light_sensor;
       ^

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Shuah Khan authored and Guenter Roeck committed Nov 16, 2015
1 parent 92e11f0 commit 5e0a0ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static int applesmc_init_index(struct applesmc_registers *s)
static int applesmc_init_smcreg_try(void)
{
struct applesmc_registers *s = &smcreg;
bool left_light_sensor, right_light_sensor;
bool left_light_sensor = 0, right_light_sensor = 0;
unsigned int count;
u8 tmp[1];
int ret;
Expand Down

0 comments on commit 5e0a0ee

Please sign in to comment.