Re: mmc: mmc_spi: Adjust error handling in mmc_spi_probe()

From: Markus Elfring
Date: Wed Dec 27 2023 - 12:29:03 EST


>> The kfree() function was called in one case by
>> the mmc_spi_probe() function during error handling
>> even if the passed variable contained a null pointer.
>> This issue was detected by using the Coccinelle software.
>
>> * Thus return directly after a call of the function “kmalloc” failed
>> at the beginning.
>>
>> * Move an error code assignment into an if branch.
>
> How is this one better?

I suggest to avoid a bit of redundant data processing also at this source code place.

Regards,
Markus