linux-stable/include
Dmitry Torokhov 8dde8fa0cc firmware_loader: introduce __free() cleanup hanler
Define cleanup handler using facilities from linux/cleanup.h to simplify
error handling in code using firmware loader. This will allow writing code
like this:

int driver_update_firmware(...)
{
	const struct firmware *fw_entry __free(firmware) = NULL;
	int error;

	...
	error = request_firmware(&fw_entry, fw_name, dev);
	if (error) {
		dev_err(dev, "failed to request firmware %s: %d",
			fw_name, error);
		return error;
	}

	error = check_firmware_valid(fw_entry);
	if (error)
		return error;

	guard(mutex)(&instance->lock);

	error = use_firmware(instance, fw);
	if (error)
		return error;

	return 0;
}

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Luis Chamberalin <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/ZaeQw7VXhnirX4pQ@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-07 22:02:12 +00:00
..
acpi IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
asm-generic RISC-V Patches for the 6.8 Merge Window, Part 4 2024-01-20 11:06:04 -08:00
clocksource
crypto
drm drm-next for 6.8: 2024-01-12 11:32:19 -08:00
dt-bindings dmaengine fixes for v6.8-rc1 2024-01-20 15:03:25 -08:00
keys
kunit Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
kvm
linux firmware_loader: introduce __free() cleanup hanler 2024-03-07 22:02:12 +00:00
math-emu
media
memory
misc
net tls: fix race between async notify and socket close 2024-02-10 21:38:19 +00:00
pcmcia
ras
rdma
rv
scsi
soc - New Device Support 2024-01-17 15:21:21 -08:00
sound ASoC: tas2781: add module parameter to tascodec_init() 2024-02-05 14:31:37 +00:00
target
trace Including fixes from WiFi and netfilter. 2024-02-08 15:09:29 -08:00
uapi Char/Misc changes for 6.8-rc5 2024-02-17 08:52:38 -08:00
ufs
vdso
video video/sticore: Remove info field from STI struct 2024-01-12 12:38:37 +01:00
xen xen: update PV-device interface headers 2024-01-09 11:46:24 +01:00