Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firewire: ohci: use cleanup helper for isoc context header allocation

Some cleanup helpers are useful in error path after memory allocation for
header storage.

Link: https://lore.kernel.org/r/20260117142823.440811-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+7 -10
+7 -10
drivers/firewire/ohci.c
··· 2958 2958 int type, int channel, size_t header_size) 2959 2959 { 2960 2960 struct fw_ohci *ohci = fw_ohci(card); 2961 + void *header __free(free_page) = NULL; 2961 2962 struct iso_context *ctx; 2962 2963 descriptor_callback_t callback; 2963 2964 u64 *channels; ··· 3016 3015 3017 3016 if (type != FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { 3018 3017 ctx->sc.header_length = 0; 3019 - ctx->sc.header = (void *) __get_free_page(GFP_KERNEL); 3020 - if (!ctx->sc.header) { 3018 + header = (void *) __get_free_page(GFP_KERNEL); 3019 + if (!header) { 3021 3020 ret = -ENOMEM; 3022 3021 goto out; 3023 3022 } ··· 3025 3024 3026 3025 ret = context_init(&ctx->context, ohci, regs, callback); 3027 3026 if (ret < 0) 3028 - goto out_with_header; 3027 + goto out; 3029 3028 fw_iso_context_init_work(&ctx->base, ohci_isoc_context_work); 3030 3029 3031 - if (type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { 3030 + if (type != FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { 3031 + ctx->sc.header = no_free_ptr(header); 3032 + } else { 3032 3033 set_multichannel_mask(ohci, 0); 3033 3034 ctx->mc.completed = 0; 3034 3035 } 3035 3036 3036 3037 return &ctx->base; 3037 - 3038 - out_with_header: 3039 - if (type != FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) { 3040 - free_page((unsigned long)ctx->sc.header); 3041 - ctx->sc.header = NULL; 3042 - } 3043 3038 out: 3044 3039 scoped_guard(spinlock_irq, &ohci->lock) { 3045 3040 switch (type) {