Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
"Fix root cause of crash/error seen in applesmc driver"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (applesmc) Always read until end of data

+13
+13
drivers/hwmon/applesmc.c
··· 230 230 231 231 static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) 232 232 { 233 + u8 status, data = 0; 233 234 int i; 234 235 235 236 if (send_command(cmd) || send_argument(key)) { ··· 238 237 return -EIO; 239 238 } 240 239 240 + /* This has no effect on newer (2012) SMCs */ 241 241 if (send_byte(len, APPLESMC_DATA_PORT)) { 242 242 pr_warn("%.4s: read len fail\n", key); 243 243 return -EIO; ··· 251 249 } 252 250 buffer[i] = inb(APPLESMC_DATA_PORT); 253 251 } 252 + 253 + /* Read the data port until bit0 is cleared */ 254 + for (i = 0; i < 16; i++) { 255 + udelay(APPLESMC_MIN_WAIT); 256 + status = inb(APPLESMC_CMD_PORT); 257 + if (!(status & 0x01)) 258 + break; 259 + data = inb(APPLESMC_DATA_PORT); 260 + } 261 + if (i) 262 + pr_warn("flushed %d bytes, last value is: %d\n", i, data); 254 263 255 264 return 0; 256 265 }