Skip to content
Commit cecf7560 authored by Tom Rix's avatar Tom Rix Committed by Guenter Roeck
Browse files

hwmon: (applesmc) check status earlier.



clang static analysis reports this representative problem

applesmc.c:758:10: warning: 1st function call argument is an
  uninitialized value
        left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

buffer is filled by the earlier call

	ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...

This problem is reported because a goto skips the status check.
Other similar problems use data from applesmc_read_key before checking
the status.  So move the checks to before the use.

Signed-off-by: default avatarTom Rix <trix@redhat.com>
Reviewed-by: default avatarHenrik Rydberg <rydberg@bitmath.org>
Link: https://lore.kernel.org/r/20200820131932.10590-1-trix@redhat.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 8aebbbb2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment