Skip to content

Commit 0c2c21a

Browse files
superm1jwrdegoede
authored andcommitted
platform/x86: amd-pmc: Only report STB errors when STB enabled
Currently if STB is disabled but an earlier function reported an error an incorrect error will be emitted about failing to write to STB. Correct this logic error by only showing errors when STB is enabled. Suggested-by: Hans de Goede <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 0d64787 commit 0c2c21a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/platform/x86/amd-pmc.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,11 @@ static void amd_pmc_s2idle_prepare(void)
655655
return;
656656
}
657657

658-
if (enable_stb)
658+
if (enable_stb) {
659659
rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF);
660-
if (rc)
661-
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
660+
if (rc)
661+
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
662+
}
662663
}
663664

664665
static void amd_pmc_s2idle_restore(void)
@@ -679,10 +680,11 @@ static void amd_pmc_s2idle_restore(void)
679680
amd_pmc_idlemask_read(pdev, pdev->dev, NULL);
680681

681682
/* Write data incremented by 1 to distinguish in stb_read */
682-
if (enable_stb)
683+
if (enable_stb) {
683684
rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF + 1);
684-
if (rc)
685-
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
685+
if (rc)
686+
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
687+
}
686688

687689
/* Notify on failed entry */
688690
amd_pmc_validate_deepest(pdev);

0 commit comments

Comments
 (0)