Skip to content

Conversation

@kakkoko
Copy link
Contributor

@kakkoko kakkoko commented Oct 16, 2024

Fix incorrect error checking of prvCreateIdleTasks

Description

In environments that do not support static allocation (configSUPPORT_STATIC_ALLOCATION == 0), at prvCreateIdleTasks(), it calls xCreateTask() and compares its return value to pdFAIL (0) to check whether xCreateTask() failed. However, xCreateTask() returns errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY (-1) as the error value, so the result of this comparison is always false.

This MR fixes this problem by changing the return value comparison to != pdPASS instead of == pdFAIL.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

In environments that do not support static allocation
(configSUPPORT_STATIC_ALLOCATION == 0), at prvCreateIdleTasks(), call
xCreateTask() and compare its return value to pdFAIL to check whether
xCreateTask() failed. However, xCreateTask() returns
errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY as the error value, so the
result of this comparison is always false.

This commit fixes this problem by changing the return value comparison
to pdPASS instead of pdFAIL.
@sonarqubecloud
Copy link

@aggarg aggarg merged commit a49c35b into FreeRTOS:main Oct 16, 2024
16 checks passed
moninom1 pushed a commit to moninom1/FreeRTOS-Kernel that referenced this pull request Sep 30, 2025
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 this pull request may close these issues.

3 participants