Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Platform] [Infineon] KVS not clean config value for CYW30739 #22610

Closed
AlvinHsiao opened this issue Sep 14, 2022 · 1 comment · Fixed by #22473
Closed

[Platform] [Infineon] KVS not clean config value for CYW30739 #22610

AlvinHsiao opened this issue Sep 14, 2022 · 1 comment · Fixed by #22473

Comments

@AlvinHsiao
Copy link
Contributor

Reproduction steps

1. Delete a zero-size value.

Platform

other

Platform Version(s)

No response

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

No response

Anything else?

No response

@AlvinHsiao AlvinHsiao changed the title [Platform] [Infineon] CYW30739 KVS check failed [Platform] [Infineon] KVS not clean config value for CYW30739 Sep 14, 2022
@AlvinHsiao
Copy link
Contributor Author

The subject of this PR contains misleading descriptions. It's a general KVS implementation fix.
When writing a zero-size value, CYW30739 only writes the key of the value to the flash because the lower layer APIs of CYW30739 doesn't support writing a zero-size value.

CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size)
{
...
if (value_size != 0)
{
SuccessOrExit(err = CYW30739Config::WriteConfigValueBin(entry->GetValueConfigKey(), value, value_size));
}
...
}
CYW30739 only has to erase the key of a zero-size value from the flash rather than erase both the key and the value from the flash.
When the original codes tried to delete a non-existed value from the flash, the lower layer API would return an error and bypass the following codes. This is the bug we are trying to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant