Re: [PATCH] platform/x86: hp-bioscfg: Use more common code in hp_init_bios_package_attribute()
Ilpo Järvinen <[email protected]> Wed, 1 Jul 2026 14:53:22 +0300 (EEST)
| Newsgroups | org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel,org.kernel.vger.platform-driver-x86 |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 18 Jun 2026, Markus Elfring wrote: > From: Markus Elfring <[email protected]> > Date: Thu, 18 Jun 2026 21:42:27 +0200 > > 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. > Signed-off-by: Markus Elfring <[email protected]> > --- > drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c > index 27fd6cd21529..819313a4425a 100644 > --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c > +++ 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; 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?!? -- i.