Skip to content

Commit d856745

Browse files
authoredJul 11, 2024
Remove some more unnecessary lock code. (project-chip#34303)
When removing a credential, we were checking to make sure the existing credential count was not too large. But this doesn't really need to be checked (as the comments around this code implied), since if we have some number of credentials already one fewer should clearly be OK.
1 parent 905dc36 commit d856745

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed
 

‎src/app/clusters/door-lock-server/door-lock-server.cpp

-22
Original file line numberDiff line numberDiff line change
@@ -2923,28 +2923,6 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric
29232923
return Status::Failure;
29242924
}
29252925

2926-
uint8_t maxCredentialsPerUser;
2927-
if (!GetNumberOfCredentialsSupportedPerUser(endpointId, maxCredentialsPerUser))
2928-
{
2929-
ChipLogError(Zcl,
2930-
"[clearCredential] Unable to get the number of available credentials per user: internal error "
2931-
"[endpointId=%d,credentialType=%d,credentialIndex=%d]",
2932-
endpointId, to_underlying(credentialType), credentialIndex);
2933-
return Status::Failure;
2934-
}
2935-
2936-
// Should never happen, only possible if the implementation of application is incorrect
2937-
if (relatedUser.credentials.size() > maxCredentialsPerUser)
2938-
{
2939-
ChipLogError(Zcl,
2940-
"[clearCredential] Unable to clear credential for related user - user has too many credentials associated"
2941-
"[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d,credentialsCount=%u]",
2942-
endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex,
2943-
static_cast<unsigned int>(relatedUser.credentials.size()));
2944-
2945-
return Status::Failure;
2946-
}
2947-
29482926
chip::Platform::ScopedMemoryBuffer<CredentialStruct> newCredentials;
29492927
if (!newCredentials.Alloc(relatedUser.credentials.size()))
29502928
{

0 commit comments

Comments
 (0)