Wrong position of "EVENT_Delete(kEVENT_TransferComplete);" in fsl_sd_disk.c ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wrong position of "EVENT_Delete(kEVENT_TransferComplete);" in fsl_sd_disk.c ?

Jump to solution
985 Views
se7ensong
Contributor II

Hello,

 

I am just wondering if the position of "EVENT_Delete(kEVENT_TransferComplete);" is wrong in SDK 2.0. The file is located in line 257 @ middleware\fatfs_0.11a\src\fsl_sd_disk\fsl_sd_disk.c.

 

I am thinking it should be placed between line 253 and 254 so that the event get removed upon failed initialisation. Could anyone from NXP please confirm if I have misunderstood the code? Thanks

 

Here is the code

 

if (kStatus_Success != SD_Init(&g_sd))
{
SD_Deinit(&g_sd);
SDHC_Deinit(BOARD_SDHC_BASEADDR);
memset(&g_sd, 0U, sizeof(g_sd));
memset(&g_sdhcAdmaTable, 0U, sizeof(g_sdhcAdmaTable));
memset(&g_sdhcHandle, 0U, sizeof(g_sdhcHandle));
+ EVENT_Delete(kEVENT_TransferComplete);
return STA_NOINIT;
}

- EVENT_Delete(kEVENT_TransferComplete);

Labels (1)
Tags (2)
1 Solution
788 Views
isaacavila
NXP Employee
NXP Employee

Hello,

This bug has already been reported and this is the report number: KPSDK-13253. I would expect to be fixed in next releases.

Regards,

Isaac

View solution in original post

3 Replies
789 Views
isaacavila
NXP Employee
NXP Employee

Hello,

This bug has already been reported and this is the report number: KPSDK-13253. I would expect to be fixed in next releases.

Regards,

Isaac

788 Views
se7ensong
Contributor II

Thank you Issac. That is really helpful. 

0 Kudos
Reply
788 Views
isaacavila
NXP Employee
NXP Employee

Hello,

Indeed, it makes sense the change that you did to delete the event when disk initialization was wrong. In this case, this EVENT_Delete was used to "initialize" the event value (to 0) although it was created with zero value at EVENT_Create function.

As EVENT_Delete function does not "free" the memory from EVENT object, there is no impact of moving the function when disk initialization fails, however, I'll report this bug to development team for further implementation where this event is created dynamically and it EVENT object needs to be freed when disk initialization fails.

Thanks for pointing this out!

Regards,

Isaac

0 Kudos
Reply