Skip to content

Commit 5d7bd02

Browse files
committed
Add defensive programming additions
1 parent c02f480 commit 5d7bd02

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/Arduino_LowPowerPortentaH7.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ LowPowerReturnCode LowPowerPortentaH7::checkOptionBytes() const
212212

213213
bool LowPowerPortentaH7::wasInCPUMode(CPUMode mode) const
214214
{
215-
auto registerValue = PWR->CPUCR;
215+
const auto registerValue = PWR->CPUCR;
216216

217217
switch (mode)
218218
{
@@ -224,6 +224,8 @@ bool LowPowerPortentaH7::wasInCPUMode(CPUMode mode) const
224224
return registerValue & PWR_CPUCR_SBF;
225225
case CPUMode::stop:
226226
return registerValue & PWR_CPUCR_STOPF;
227+
default:
228+
return false;
227229
}
228230

229231
return false;

0 commit comments

Comments
 (0)