All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sean Rhodes" <sean@starlabs.systems>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v10 4/4] firmware: coreboot: Add CFR firmware attributes driver
Date: Tue, 28 Jul 2026 08:34:13 +0000	[thread overview]
Message-ID: <20260728083414.5A16E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <c0e5bc377342ef9a5e2e90f65cc00093f89fbb1c.1785226810.git.sean@starlabs.systems>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Mixing goto-based error handling with scope-based cleanup helpers (`__free` and `guard`) in the same function.
--

--- Patch [4]: [PATCH v10 4/4] firmware: coreboot: Add CFR firmware attributes driver ---
commit f075e88024f4dbd198791a1dc20f657a026b2206
Author: Sean Rhodes <sean@starlabs.systems>

firmware: coreboot: Add CFR firmware attributes driver

This commit adds a firmware-attributes driver for coreboot CFR settings. It
exposes runtime EFI variable-backed configuration options to userspace via
sysfs, allowing modification and handling of runtime-apply mechanisms.

Link: https://doc.coreboot.org/drivers/cfr.html
Link: https://doc.coreboot.org/drivers/cfr_internal.html

> diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/coreboot/coreboot-cfr.c
> new file mode 100644
> index 0000000000000..21b06aa363111
> --- /dev/null
> +++ b/drivers/firmware/coreboot/coreboot-cfr.c

[ ... ]

> +static int coreboot_cfr_write_value(struct coreboot_cfr_setting *setting,
> +				    u32 value)
> +{
> +	efi_char16_t *efi_name __free(kfree) = NULL;
> +	u32 attrs;
> +	u32 old;
> +	int restore_ret;
> +	int ret;
> +
> +	if (setting->read_only)
> +		return -EACCES;
> +
> +	efi_name = coreboot_cfr_efi_name(setting->name);
> +	if (IS_ERR(efi_name))
> +		return PTR_ERR(no_free_ptr(efi_name));
> +
> +	guard(mutex)(&setting->drvdata->lock);
> +
> +	ret = efivar_lock();
> +	if (ret)
> +		return ret;
> +
> +	ret = coreboot_cfr_read_efi_value(efi_name, &old, &attrs);
> +	if (ret)
> +		goto out_unlock_efi;

[ ... ]

> +
> +out_unlock_efi:
> +	efivar_unlock();
> +	return ret;
> +}

[Severity: Medium]
Does this mix goto-based error handling with scope-based cleanups in the same
function?

According to include/linux/cleanup.h, the expectation is that usage of goto
and cleanup helpers (like __free and guard) should never be mixed in the
same routine. Mixing them creates confusing resource ownership semantics and
increases the risk of future resource leaks.

Could this be unified to exclusively use either traditional goto labels or
scope-based cleanups? For instance, efivar_lock() could potentially use a
cleanup helper to avoid the goto out_unlock_efi labels entirely.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1785226809.git.sean@starlabs.systems?part=4

      reply	other threads:[~2026-07-28  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  8:20 [PATCH v10 0/4] coreboot CFR firmware attributes Sean Rhodes
2026-07-28  8:20 ` [PATCH v10 1/4] platform/x86: Sort firmware attributes class includes Sean Rhodes
2026-07-28  8:20 ` [PATCH v10 2/4] firmware: Move firmware attributes class helper Sean Rhodes
2026-07-28  8:32   ` sashiko-bot
2026-07-28  8:20 ` [PATCH v10 3/4] firmware: Rename google firmware directory to coreboot Sean Rhodes
2026-07-28  8:20 ` [PATCH v10 4/4] firmware: coreboot: Add CFR firmware attributes driver Sean Rhodes
2026-07-28  8:34   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728083414.5A16E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sean@starlabs.systems \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.