Skip to content

Commit

Permalink
platform/x86: amd-pmc: Only report STB errors when STB enabled
Browse files Browse the repository at this point in the history
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 <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220317190301.6818-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Mario Limonciello authored and Hans de Goede committed Mar 18, 2022
1 parent 0d64787 commit 0c2c21a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/platform/x86/amd-pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,11 @@ static void amd_pmc_s2idle_prepare(void)
return;
}

if (enable_stb)
if (enable_stb) {
rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF);
if (rc)
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
if (rc)
dev_err(pdev->dev, "error writing to STB: %d\n", rc);
}
}

static void amd_pmc_s2idle_restore(void)
Expand All @@ -679,10 +680,11 @@ static void amd_pmc_s2idle_restore(void)
amd_pmc_idlemask_read(pdev, pdev->dev, NULL);

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

/* Notify on failed entry */
amd_pmc_validate_deepest(pdev);
Expand Down

0 comments on commit 0c2c21a

Please sign in to comment.