Re: [PATCH] platform/x86: hp-bioscfg: Use more common code in hp_init_bios_package_attribute()

From: Markus Elfring

Date: Wed Jul 01 2026 - 13:55:30 EST


>> Use an existing label once more so that a bit of common code can be better
>> reused at the end of this function implementation.
>>
>> This issue was detected by using the Coccinelle software.
>
> This patch leaves me quite unimpressed of Coccinelle's abilities.

The intention of this development tool is not to impress you with a possible
source code transformation.



>> +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
>> @@ -692,8 +692,7 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type,
>> if (ret) {
>> pr_debug("Failed to populate integer package data. Error [0%0x]\n",
>> ret);
>> - kfree(str_value);
>> - return ret;
>> + goto pack_attr_exit;

Another source code search approach pointed implementation details out
for further development considerations.


> If a call fails, it's expected to handle cleanup itself --- which is
> exactly what hp_convert_hexstr_to_str() appears to be doing (by not
> writing into *str until it's committed to returning 0). So why is
> this kfree() necessary in the first place?!?
Would any contributors like to adjust background information accordingly?

Regards,
Markus