Skip to content

Commit d878bdf

Browse files
committed
platform/x86: surface3_power: Fix always true condition in mshw0011_space_handler()
smatch warnings: .../surface3_power.c:417 mshw0011_space_handler() warn: always true condition '(ret >= 0) => +(0-u32max >= 0)' Refactor error handling returned by mshw0011_adp_psr() to avoid always true condition. Reported-by: kbuild test robot <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent ba308bd commit d878bdf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/platform/x86/surface3_power.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,14 @@ mshw0011_space_handler(u32 function, acpi_physical_address command,
402402

403403
if (gsb->cmd.arg0 == MSHW0011_CMD_DEST_ADP1 &&
404404
gsb->cmd.arg1 == MSHW0011_CMD_ADP1_PSR) {
405-
ret = mshw0011_adp_psr(cdata);
406-
if (ret >= 0) {
407-
status = ret;
408-
ret = 0;
405+
status = mshw0011_adp_psr(cdata);
406+
if (status >= 0) {
407+
ret = AE_OK;
408+
goto out;
409+
} else {
410+
ret = AE_ERROR;
411+
goto err;
409412
}
410-
goto out;
411413
}
412414

413415
if (gsb->cmd.arg0 != MSHW0011_CMD_DEST_BAT0) {

0 commit comments

Comments
 (0)