summaryrefslogtreecommitdiffstats
path: root/PcAtChipsetPkg
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2022-11-08 15:32:41 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-04-03 15:29:08 +0000
commit7dc182ed1e7198420fa10fb523e3d52093fefab2 (patch)
tree3d2151b768585beedf2f71a570fe5738c1ca1c48 /PcAtChipsetPkg
parent3fab32d41dc7f45db498800328db9f1fb6699075 (diff)
downloadedk2-7dc182ed1e7198420fa10fb523e3d52093fefab2.tar.gz
edk2-7dc182ed1e7198420fa10fb523e3d52093fefab2.tar.bz2
edk2-7dc182ed1e7198420fa10fb523e3d52093fefab2.zip
PcAtChipsetPkg: Fix conditionally uninitialized variables
Fixes CodeQL alerts for CWE-457: https://cwe.mitre.org/data/definitions/457.html Cc: Erich McMillan <emcmillan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Ray Ni <ray.ni@intel.com> Co-authored-by: Erich McMillan <emcmillan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
Diffstat (limited to 'PcAtChipsetPkg')
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 15759463f2..d8b9fa8376 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -345,7 +345,7 @@ PcRtcInit (
// so we can use them to get and set wakeup time.
//
Status = PcRtcGetWakeupTime (&Enabled, &Pending, &Time, Global);
- if ((Enabled) || (!EFI_ERROR (Status))) {
+ if ((!EFI_ERROR (Status)) || (Enabled)) {
return EFI_SUCCESS;
}
@@ -838,8 +838,11 @@ PcRtcSetWakeupTime (
//
// Just support set alarm time within 24 hours
//
- PcRtcGetTime (&RtcTime, &Capabilities, Global);
- Status = RtcTimeFieldsValid (&RtcTime);
+ Status = PcRtcGetTime (&RtcTime, &Capabilities, Global);
+ if (!EFI_ERROR (Status)) {
+ Status = RtcTimeFieldsValid (&RtcTime);
+ }
+
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}