LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5 0/8] Generic IRQ entry/exit support for powerpc
From: Andreas Schwab @ 2026-07-05 12:02 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Mukesh Kumar Chaurasiya (IBM), maddy, mpe, npiggin, ryabinin.a.a,
	glider, andreyknvl, dvyukov, vincenzo.frascino, oleg, kees, luto,
	wad, mchauras, sshegde, thuth, ruanjinjie, akpm, macro, ldv,
	charlie, deller, kevin.brodsky, ritesh.list, yeoreum.yun,
	agordeev, segher, mark.rutland, ryan.roberts, pmladek, feng.tang,
	peterz, kan.liang, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <1693b268-ee26-4764-871a-5a067ae96080@kernel.org>

BUG: Unable to handle kernel data access at 0x30af548c0000028
Faulting instruction address: 0xc0000000000af47c

c0000000000aee6c <.sched_balance_find_src_group>:

c0000000000af474:       e9 3f 00 18     ld      r9,24(r31)
c0000000000af478:       e9 29 0d 48     ld      r9,3400(r9)
c0000000000af47c:       89 49 00 28     lbz     r10,40(r9)
c0000000000af480:       7c 0a e0 40     cmplw   r10,r28

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply

* Re: [PATCH v5 0/8] Generic IRQ entry/exit support for powerpc
From: Andreas Schwab @ 2026-07-05 11:35 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Mukesh Kumar Chaurasiya (IBM), maddy, mpe, npiggin, ryabinin.a.a,
	glider, andreyknvl, dvyukov, vincenzo.frascino, oleg, kees, luto,
	wad, mchauras, sshegde, thuth, ruanjinjie, akpm, macro, ldv,
	charlie, deller, kevin.brodsky, ritesh.list, yeoreum.yun,
	agordeev, segher, mark.rutland, ryan.roberts, pmladek, feng.tang,
	peterz, kan.liang, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <1693b268-ee26-4764-871a-5a067ae96080@kernel.org>

On Jul 05 2026, Christophe Leroy (CS GROUP) wrote:

> Le 04/07/2026 à 17:49, Andreas Schwab a écrit :
>> This breaks booting on the PowerMac G5 (PowerMac7,3), there is a panic
>> somwhere in an irq.
>> 
>
> Do you have more details ? Like at least the dump of the panic Oops ?

NIP .power4_idle_nap+0x30/0x34
LR .power4_idle+0x64/0x70
--- interrupt: 900

.arch_spu_idle+0x88/0x100
.default_idle_call+0x3c/0x5c
.do_idle+0x194/0x2b4
.cpu_startup_entry+0x3c/0x40
.start_secondary+0x6b0/0x820
start_secondary_prolog+0x10/0x14

> Can it be reproduced on QEMU ?

No, qemu does not support SMP.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply

* [PATCH] KVM: Use vma_lookup() in kvm_host_page_size()
From: David Woodhouse @ 2026-07-05  8:38 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm, linux-kernel, Madhavan Srinivasan, Nicholas Piggin,
	Michael Ellerman, Christophe Leroy (CS GROUP), linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

From: David Woodhouse <dwmw@amazon.co.uk>

kvm_host_page_size() uses find_vma() to determine the host page size
backing a guest page. find_vma() returns the next VMA when the address
falls in an unmapped hole, which means an unmapped address inherits the
page size of a completely unrelated VMA at a higher address. This is
never a meaningful result.

Replace find_vma() with vma_lookup() so that a hole address returns
NULL, causing the function to return PAGE_SIZE (the safe default)
rather than an unrelated VMA's page size.

This is currently only cosmetic, as the only caller is in PPC book3s
support (kvmppc_xive_native_set_queue_config()) and subsequently returns
failure if !gfn_to_page() anyway.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 89489996fbc1..d33761123459 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2693,7 +2693,7 @@ unsigned long kvm_host_page_size(struct kvm_vcpu *vcpu, gfn_t gfn)
 		return PAGE_SIZE;
 
 	mmap_read_lock(current->mm);
-	vma = find_vma(current->mm, addr);
+	vma = vma_lookup(current->mm, addr);
 	if (!vma)
 		goto out;
 
-- 
2.43.0


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]

^ permalink raw reply related

* Re: [PATCH v5 0/8] Generic IRQ entry/exit support for powerpc
From: Christophe Leroy (CS GROUP) @ 2026-07-05  6:49 UTC (permalink / raw)
  To: Andreas Schwab, Mukesh Kumar Chaurasiya (IBM)
  Cc: maddy, mpe, npiggin, ryabinin.a.a, glider, andreyknvl, dvyukov,
	vincenzo.frascino, oleg, kees, luto, wad, mchauras, sshegde,
	thuth, ruanjinjie, akpm, macro, ldv, charlie, deller,
	kevin.brodsky, ritesh.list, yeoreum.yun, agordeev, segher,
	mark.rutland, ryan.roberts, pmladek, feng.tang, peterz, kan.liang,
	linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <87wlvazrdy.fsf@igel.home>



Le 04/07/2026 à 17:49, Andreas Schwab a écrit :
> This breaks booting on the PowerMac G5 (PowerMac7,3), there is a panic
> somwhere in an irq.
> 

Do you have more details ? Like at least the dump of the panic Oops ?

Can it be reproduced on QEMU ?

Christophe


^ permalink raw reply

* Re: [RFC] entry: Untangle the return value of syscall_enter_from_user_mode from syscall NR
From: H. Peter Anvin @ 2026-07-04 17:18 UTC (permalink / raw)
  To: Sven Schnelle, Michal Suchánek
  Cc: Peter Zijlstra, Thomas Gleixner, Jonathan Corbet, Shuah Khan,
	Huacai Chen, WANG Xuerui, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Andy Lutomirski, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Andrew Donnellan, Mark Rutland, Arnd Bergmann, Jiaxun Yang,
	Ryan Roberts, Greg Kroah-Hartman, Mukesh Kumar Chaurasiya,
	Shrikanth Hegde, Zong Li, Nam Cao, Deepak Gupta, Lukas Gerlach,
	Rui Qi, Kees Cook, linux-doc, linux-kernel, loongarch,
	linuxppc-dev, linux-riscv, linux-s390
In-Reply-To: <yt9dtsqg480p.fsf@linux.ibm.com>

On July 3, 2026 4:39:18 AM PDT, Sven Schnelle <svens@linux.ibm.com> wrote:
>Michal Suchánek <msuchanek@suse.de> writes:
>
>> The same could be asked of syscall_enter_from_user_mode. I find it very
>> odd. Why does it conflate the syscall number with its return value?
>>
>> It never uses the syscall number passed in except when returning it
>> unchanged. When it pokes the registers it reads the syscall number from
>> them.
>>
>> If the caller of syscall_enter_from_user_mode only read the syscall
>> number from the registers when syscall_enter_from_user_mode returns and
>> indicates the syscall should be still executed this whole shenigan would
>
>I agree. The fact that if (nr < NR_syscall) just works because -1 gets
>casted to 0xffffffff and is therefore out of bounds is very odd.
>

Not at all strange. It is an *extremely* common construct in C, especially for range checking values into [0, n).

In addition to being idiomatic, keep in mind that this is one of the absolutely most performance critical paths in the entire kernel. One of the fundamental cornerstones behind Unix is to keep system calls cheap so that they can be simple building blocks for more complex operations. It is not the only possible design philosophy, but it is the one we chose to adopt, quite successfully.

The downside? Squeezing every possible cycle out of the system call path becomes one of the most essential tuning tasks. The good part is that keeping the system call path clean also makes it maintainable, even when there are quirks.


^ permalink raw reply

* Re: [RFC] entry: Untangle the return value of syscall_enter_from_user_mode from syscall NR
From: H. Peter Anvin @ 2026-07-04 17:23 UTC (permalink / raw)
  To: Thomas Gleixner, Michal Suchánek, Peter Zijlstra
  Cc: Jonathan Corbet, Shuah Khan, Huacai Chen, WANG Xuerui,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Andy Lutomirski, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Andrew Donnellan, Mark Rutland, Arnd Bergmann, Jiaxun Yang,
	Ryan Roberts, Greg Kroah-Hartman, Mukesh Kumar Chaurasiya,
	Shrikanth Hegde, Zong Li, Nam Cao, Deepak Gupta, Lukas Gerlach,
	Rui Qi, Kees Cook, linux-doc, linux-kernel, loongarch,
	linuxppc-dev, linux-riscv, linux-s390
In-Reply-To: <87h5mhnjsr.ffs@fw13>

On July 2, 2026 2:49:56 PM PDT, Thomas Gleixner <tglx@kernel.org> wrote:
>On Wed, Jul 01 2026 at 11:29, H. Peter Anvin wrote:
>
>Can you please trim your replies? Scrolling through hundred lines of
>useless quoted text is just annoying.
>
>> On July 1, 2026 10:42:08 AM PDT, "Michal Suchánek" <msuchanek@suse.de> wrote:
>>>-static __always_inline long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
>>>+static __always_inline long syscall_enter_from_user_mode(struct pt_regs *regs, long *syscall)
>>> {
>>> 	long ret;
>>>
>
>> 1. The type for a system call is int.
>
>That ship has sailed long ago. man syscall ...
>
>> 2. A valid system call number is always going to be positive.
>
>That's true today.
>
>> 3. Bits [30:24] are available for architecture ABI use. The
>>    "architecture independent" part of the system call number is therefore
>>    24 bits wide.
>>
>> 4. The exact ABI is platform-specific, obviously, but as a general
>>    guideline (especially for new platforms/ABIs) should follow the rules
>>    for a platform "int" if practical. Notably, when passing a value in a
>>    register larger than 32 bits, which side of the calling interface is
>>    responsible for sign-extending a value passed in a register. If caller
>>    side, the kernel should validate, if callee side the kernel should
>>    ignore the additional bits and do the extension.
>
>The kernel sign expands today already, i.e. for compat syscalls.
>
>> 5. A negative system call number is guaranteed to return -ENOSYS
>>    (unless intercepted by seccomp, ptrace, or another mechanism under
>>    user space control.)
>
>That's true today.
>
>ASM entry:
>       regs->eax = -ENOSYS;
>
>C entry:
>       nr = syscall_enter_from_user_mode(regs, nr);
>
>       if ((unsigned)nr < SYSCALL_MAX)
>       	    regs->eax = handle_syscall();
>       else if (nr != -1)
>       	    regs->eax = -ENOSYS;
>
>       ....
>
>If seccomp overwrites regs->eax and aborts any syscall (including -1) by
>returning -1, then the value seccomp wrote into regs->eax is preserved
>and returned to user space.
>
>The same applies for syscall_user_dispatch() and ptrace...() if they
>decide to overwrite regs->eax _and_ abort the syscall by letting
>syscall_enter_from_user_mode() return -1.
>
>trace_syscall_enter() is not any different. If the magic BPF in there
>rewrites the syscall number to -1 then either the original -ENOSYS or
>the BPF induced overwrite is returned to user space.
>
>It's less than obvious and I have no objections to clean that up and
>make it more intuitive, but I still fail to see what Michal is actually
>trying to solve and what the magic flag is for. If s390 requires it,
>then that's an s390 problem, but definitely x86 does not.
>
>> 6. If the platform needs to algorithmically modify the system call
>>    number due to platform-specific concerns (say, the platform uses a
>>    16-bit special purpose register for the syscall number, or it has
>>    multiple kernel entry points with different behavior), it should if at
>>    all possible transcode the system call number as necessary to match
>>    this convention in APIs that are exposed to general kernel code.
>>
>> For example, in the future I could very much see the IA32 code in the
>> x86 kernel using bit 29 internally to indicate an ia32 system call,
>> simplifying the is_compat implementation on x86.
>
>I don't see how that makes it simpler. Those are two different entry
>code paths and magic bits wont make that go away.
>
>> It should not mean that passing bit 29 to either the syscall
>> instruction or int $0x80 will be accepted.
>
>Your proposal looks even more like a solution in search of a problem
>than the original one.
>
>Thanks,
>
>        tglx
>
>

The type in syscall(3) is irrelevant. The argument passed to the kernel is treated as an int and sign-extended from 32 bits. 

I'm explicitly not trying to invent things; I'm trying to document the status quo to avoid further confusion and to create mistakes. 

I'm sorry I muddled the waters with what was intended to be a hypothetical example.


^ permalink raw reply

* Re: [PATCH v5 0/8] Generic IRQ entry/exit support for powerpc
From: Andreas Schwab @ 2026-07-04 15:49 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya (IBM)
  Cc: maddy, mpe, npiggin, chleroy, ryabinin.a.a, glider, andreyknvl,
	dvyukov, vincenzo.frascino, oleg, kees, luto, wad, mchauras,
	sshegde, thuth, ruanjinjie, akpm, macro, ldv, charlie, deller,
	kevin.brodsky, ritesh.list, yeoreum.yun, agordeev, segher,
	mark.rutland, ryan.roberts, pmladek, feng.tang, peterz, kan.liang,
	linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <20260427122742.210074-1-mkchauras@gmail.com>

This breaks booting on the PowerMac G5 (PowerMac7,3), there is a panic
somwhere in an irq.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply

* [PATCH] powerpc/perf: Use strstarts() to simplify is_thread_imc_pmu()
From: Thorsten Blum @ 2026-07-04 12:13 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Kees Cook, Shrikanth Hegde,
	Yury Norov
  Cc: Thorsten Blum, linuxppc-dev, linux-kernel

Replace the open-coded implementation with strstarts() to simplify
is_thread_imc_pmu().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/perf/imc-pmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index e3822f36c419..1d2db6d3e226 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -1023,10 +1023,7 @@ static int thread_imc_event_init(struct perf_event *event)
 
 static bool is_thread_imc_pmu(struct perf_event *event)
 {
-	if (!strncmp(event->pmu->name, "thread_imc", strlen("thread_imc")))
-		return true;
-
-	return false;
+	return strstarts(event->pmu->name, "thread_imc");
 }
 
 static __be64 *get_event_base_addr(struct perf_event *event)


^ permalink raw reply related

* Re: [PATCH] soc: fsl: dpio: Use common error handling code in two functions
From: Markus Elfring @ 2026-07-04 10:11 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP), linux-arm-kernel, linuxppc-dev,
	Roy Pledge
  Cc: LKML, kernel-janitors
In-Reply-To: <d95d2f4c-f3cf-44eb-b61b-79ba7891674d@kernel.org>

>> Use additional labels so that a bit of exception handling can be better
>> reused at the end of two function implementations.
>>
>> This issue was detected by using the Coccinelle software.
> 
> I think it would be better to declare obj and ret as automatic free instead:

Please reconsider such information in more detail.


>     struct dpaa2_io __free(kfree) *obj = kmalloc_obj(*obj);

The application of scope-base resource management can eventually be increased further.

Regards,
Markus

^ permalink raw reply

* Re: [PATCH] soc: fsl: dpio: Use common error handling code in two functions
From: Christophe Leroy (CS GROUP) @ 2026-07-04  9:19 UTC (permalink / raw)
  To: Markus Elfring, linux-arm-kernel, linuxppc-dev, Roy Pledge
  Cc: LKML, kernel-janitors
In-Reply-To: <690827f2-e746-4378-bb7c-9948cd69dc15@web.de>



Le 11/06/2026 à 12:02, Markus Elfring a écrit :
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 11 Jun 2026 11:56:18 +0200
> 
> Use additional labels so that a bit of exception handling can be better
> reused at the end of two function implementations.
> 
> This issue was detected by using the Coccinelle software.

I think it would be better to declare obj and ret as automatic free instead:

	struct dpaa2_io __free(kfree) *obj = kmalloc_obj(*obj);



> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   drivers/soc/fsl/dpio/dpio-service.c | 30 ++++++++++++++---------------
>   1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/soc/fsl/dpio/dpio-service.c b/drivers/soc/fsl/dpio/dpio-service.c
> index 317ca50b0c2b..025d9fb5660d 100644
> --- a/drivers/soc/fsl/dpio/dpio-service.c
> +++ b/drivers/soc/fsl/dpio/dpio-service.c
> @@ -140,10 +140,8 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
>   		return NULL;
>   
>   	/* check if CPU is out of range (-1 means any cpu) */
> -	if (desc->cpu != DPAA2_IO_ANY_CPU && desc->cpu >= num_possible_cpus()) {
> -		kfree(obj);
> -		return NULL;
> -	}
> +	if (desc->cpu != DPAA2_IO_ANY_CPU && desc->cpu >= num_possible_cpus())
> +		goto free_obj;
>   
>   	obj->dpio_desc = *desc;
>   	obj->swp_desc.cena_bar = obj->dpio_desc.regs_cena;
> @@ -158,11 +156,8 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
>   	qman_256_cycles_per_ns = 256000 / (obj->swp_desc.qman_clk / 1000000);
>   	obj->swp_desc.qman_256_cycles_per_ns = qman_256_cycles_per_ns;
>   	obj->swp = qbman_swp_init(&obj->swp_desc);
> -
> -	if (!obj->swp) {
> -		kfree(obj);
> -		return NULL;
> -	}
> +	if (!obj->swp)
> +		goto free_obj;
>   
>   	INIT_LIST_HEAD(&obj->node);
>   	spin_lock_init(&obj->lock_mgmt_cmd);
> @@ -192,6 +187,10 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
>   	obj->frames = 0;
>   
>   	return obj;
> +
> +free_obj:
> +	kfree(obj);
> +	return NULL;
>   }
>   
>   /**
> @@ -665,10 +664,8 @@ struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
>   	ret->max = max_frames;
>   	size = max_frames * sizeof(struct dpaa2_dq) + 64;
>   	ret->alloced_addr = kzalloc(size, GFP_KERNEL);
> -	if (!ret->alloced_addr) {
> -		kfree(ret);
> -		return NULL;
> -	}
> +	if (!ret->alloced_addr)
> +		goto free_ret;
>   
>   	ret->vaddr = PTR_ALIGN(ret->alloced_addr, 64);
>   	ret->paddr = dma_map_single(dev, ret->vaddr,
> @@ -676,14 +673,17 @@ struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
>   				    DMA_FROM_DEVICE);
>   	if (dma_mapping_error(dev, ret->paddr)) {
>   		kfree(ret->alloced_addr);
> -		kfree(ret);
> -		return NULL;
> +		goto free_ret;
>   	}
>   
>   	ret->idx = 0;
>   	ret->dev = dev;
>   
>   	return ret;
> +
> +free_ret:
> +	kfree(ret);
> +	return NULL;
>   }
>   EXPORT_SYMBOL_GPL(dpaa2_io_store_create);
>   



^ permalink raw reply

* Re: [PATCH next] drivers/bus/fsl-mc: Use strscpy() to copy strings into arrays
From: Christophe Leroy (CS GROUP) @ 2026-07-04  9:10 UTC (permalink / raw)
  To: david.laight.linux, Kees Cook, Ioana Ciornei
  Cc: Arnd Bergmann, linux-kernel, linux-hardening, linuxppc-dev
In-Reply-To: <20260608095500.2567-1-david.laight.linux@gmail.com>



Le 08/06/2026 à 11:54, david.laight.linux@gmail.com a écrit :
> From: David Laight <david.laight.linux@gmail.com>
> 
> Replacing strcpy() with strscpy() ensures than overflow of the target
> buffer cannot happen.
> 
> Signed-off-by: David Laight <david.laight.linux@gmail.com>
> ---
> This is one of a group of patches that remove potentially unbounded
> strcpy() calls.
> 
> They are mostly replaced by strscpy() or, when strlen() has just been
> called, with memcpy() (usually including the '\0').
> 
> Calls with copy string literals into arrays are left unchanged.
> They are safe and easily detected as such.
> 
> The changes were made by getting the compiler to detect the calls and
> then fixing the code by hand.
> 
> Note that all the changes are only compile tested.
> 
> Some Makefiles were changed to allow files to contain strcpy().
> As well as 'difficult to fix' files, this included 'show' functions
> as they really need to use sysfs_emit() or seq_printf().
> 
> All the patches are being sent individually to avoid very long cc lists.
> Apologies for the terse commit messages and likely unexpected tags.
> (There are about 100 patches in total.)
> 
>   drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Do you expect this patch to go via individual trees or will you apply 
them all together in a given tree ?

Ioana, as usual I can take it via soc/fsl/ with your Ack.

Christophe

> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 221146e4860b..372175fe169c 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -903,7 +903,7 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev,
>   	int state, err;
>   
>   	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
> -	strcpy(endpoint1.type, mc_dev->obj_desc.type);
> +	strscpy(endpoint1.type, mc_dev->obj_desc.type);
>   	endpoint1.id = mc_dev->obj_desc.id;
>   	endpoint1.if_id = if_id;
>   
> @@ -920,7 +920,7 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev,
>   		return ERR_PTR(err);
>   	}
>   
> -	strcpy(endpoint_desc.type, endpoint2.type);
> +	strscpy(endpoint_desc.type, endpoint2.type);
>   	endpoint_desc.id = endpoint2.id;
>   	endpoint = fsl_mc_device_lookup(&endpoint_desc, mc_bus_dev);
>   	if (endpoint)



^ permalink raw reply

* Re: [PATCH] perf data convert json: Fix trace_seq memory leak in process_sample_event()
From: Namhyung Kim @ 2026-07-03 23:59 UTC (permalink / raw)
  To: Tanushree Shah
  Cc: Arnaldo Carvalho de Melo, jolsa, adrian.hunter, vmolnaro, mpetlan,
	tmricht, maddy, irogers, linux-perf-users, linuxppc-dev, atrajeev,
	hbathini, Tejas.Manhas1, Tanushree.Shah, Shivani.Nittor
In-Reply-To: <bf12f3d6-7410-44da-b4c4-32dc21244a12@linux.ibm.com>

On Thu, Jul 02, 2026 at 12:46:54PM +0530, Tanushree Shah wrote:
> Hi Namhyung,
> 
> Yes, I was planning to send a v2 based on the review comments to fix the
> pre-existing issue.
> 
> However, Arnaldo mentioned that the original patch had already been merged
> before I got to send a v2, so I addressed the pre-existing issue in a
> separate patch instead. The patch is available here:
> 
> https://lore.kernel.org/linux-perf-users/20260606121528.406919-2-tshah@linux.ibm.com/
> 
> That said, although Arnaldo mentioned that this patch had been merged, I
> don't see it in perf-tools-next yet either. I'll wait for him to clarify its
> current status.

It's not in the perf-tools-next, and no plan to add it.  Please send v2.

Thanks,
Namhyung



^ permalink raw reply

* Re: [PATCH 03/42] firmware: qcom: scm: Use devm_of_reserved_mem_device_init()
From: Dmitry Baryshkov @ 2026-07-03 23:12 UTC (permalink / raw)
  To: Mukesh Ojha
  Cc: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan, Ekansh Gupta,
	BST Linux Kernel Upstream Group, Fabio Estevam, Nicolin Chen,
	Pengutronix Kernel Team, Kai Vehmanen, Pierre-Louis Bossart,
	Vijendar Mukunda, Chunyan Zhang, CIX Linux Kernel Upstream Group,
	linux-arm-msm, linux-kernel, dri-devel, linux-aspeed,
	linux-arm-kernel, linux-mips, linux-sunxi, linux-media, openbmc,
	linux-mediatek, kernel, linux-tegra, linux-mmc, devicetree,
	linux-remoteproc, linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware
In-Reply-To: <20260703193855.110619-4-mukesh.ojha@oss.qualcomm.com>

On Sat, Jul 04, 2026 at 01:08:16AM +0530, Mukesh Ojha wrote:
> Switch from of_reserved_mem_device_init() to the new resource managed
> devm_of_reserved_mem_device_init() so that the reserved memory region
> is released automatically on probe failure or device unbind. This
> eliminates the err_rmem cleanup label and the need to call
> of_reserved_mem_device_release() explicitly on error paths.
> 
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
>  drivers/firmware/qcom/qcom_scm.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry


^ permalink raw reply

* Re: [PATCH v16 01/18] seccomp: Convert __secure_computing() to return boolean
From: Linus Walleij @ 2026-07-03 21:32 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Thomas Gleixner, Michal Suchánek, Jinjie Ruan, oleg,
	richard.henderson, mattst88, linmag7, linux, catalin.marinas,
	will, kees, guoren, chenhuacai, kernel, geert, tsbogend,
	James.Bottomley, deller, maddy, mpe, npiggin, chleroy, pjw,
	palmer, aou, alex, hca, gor, agordeev, borntraeger, svens, ysato,
	dalias, glaubitz, richard, anton.ivanov, johannes, luto, mingo,
	bp, dave.hansen, hpa, chris, jcmvbkbc, peterz, wad, thuth,
	ada.coupriediaz, kevin.brodsky, yeoreum.yun, song, james.morse,
	anshuman.khandual, broonie, liqiang01, pengcan, ryan.roberts,
	yangtiezhu, sshegde, mchauras, austin.kim, jchrist, arnd,
	thomas.weissschuh, sohil.mehta, andrew.cooper3, jgross, kas, x86,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-mm, linux-csky,
	loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
	linux-riscv, linux-s390, linux-sh, linux-um
In-Reply-To: <akeIK5TRCjlKbzbp@J2N7QTR9R3>

On Fri, Jul 3, 2026 at 12:00 PM Mark Rutland <mark.rutland@arm.com> wrote:

> Bikeshedding below; sorry.
>
> I think the bigger problem is just that secure_computing() is a terrible
> name that does not express the intended semantic -- it's not clear
> whether "secure computing" means "seccomp permit the syscall" or
> "seccomp is enabled and some special rules now apply" or something else
> entirely.
>
> If we're changing the return type, it might be worth renaming the
> function something like:
>
>         seccomp_permits_syscall()

Yeah that's way better, let's do this.
(I also had problems with this function!!)

Rusty Russel's API design manifesto tells us to do this:
https://gist.github.com/mjball/9cd028ac793ae8b351df1379f1e721f9

Yours,
Linus Walleij


^ permalink raw reply

* Re: [PATCH v16 01/18] seccomp: Convert __secure_computing() to return boolean
From: H. Peter Anvin @ 2026-07-03 21:01 UTC (permalink / raw)
  To: Thomas Gleixner, Kevin Brodsky, Michal Suchánek,
	Mark Rutland
  Cc: Jinjie Ruan, oleg, richard.henderson, mattst88, linmag7, linux,
	catalin.marinas, will, kees, guoren, chenhuacai, kernel, geert,
	tsbogend, James.Bottomley, deller, maddy, mpe, npiggin, chleroy,
	pjw, palmer, aou, alex, hca, gor, agordeev, borntraeger, svens,
	ysato, dalias, glaubitz, richard, anton.ivanov, johannes, luto,
	mingo, bp, dave.hansen, chris, jcmvbkbc, peterz, wad, thuth,
	ada.coupriediaz, linusw, yeoreum.yun, song, james.morse,
	anshuman.khandual, broonie, liqiang01, pengcan, ryan.roberts,
	yangtiezhu, sshegde, mchauras, austin.kim, jchrist, arnd,
	thomas.weissschuh, sohil.mehta, andrew.cooper3, jgross, kas, x86,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-mm, linux-csky,
	loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
	linux-riscv, linux-s390, linux-sh, linux-um
In-Reply-To: <87echjlrs4.ffs@fw13>

On July 3, 2026 1:52:43 PM PDT, Thomas Gleixner <tglx@kernel.org> wrote:
>On Fri, Jul 03 2026 at 13:59, Kevin Brodsky wrote:
>> On 03/07/2026 12:27, Michal Suchánek wrote:
>>>> If we're changing the return type, it might be worth renaming the
>>>> function something like:
>>>>
>>>> 	seccomp_permits_syscall()
>>> Then not only it is clear which way the boolean value should be
>>> interpreted, it also pervents the accidental inversion of existing
>>> calls. Overall great.
>>
>> Totally agreed, if we have the opportunity to rename a completely
>> undescriptive function name like "secure_computing" we should take it.
>
>Absolutely no objections from my side on that.
>

Hell yes. 


^ permalink raw reply

* [PATCH 03/42] firmware: qcom: scm: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Switch from of_reserved_mem_device_init() to the new resource managed
devm_of_reserved_mem_device_init() so that the reserved memory region
is released automatically on probe failure or device unbind. This
eliminates the err_rmem cleanup label and the need to call
of_reserved_mem_device_release() explicitly on error paths.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/firmware/qcom/qcom_scm.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 26bf87247afa..0f9559b9cc53 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -2779,17 +2779,15 @@ static int qcom_scm_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = of_reserved_mem_device_init(scm->dev);
+	ret = devm_of_reserved_mem_device_init(scm->dev);
 	if (ret && ret != -ENODEV)
 		return dev_err_probe(scm->dev, ret,
 				     "Failed to setup the reserved memory region for TZ mem\n");
 
 	ret = qcom_tzmem_enable(scm->dev);
-	if (ret) {
-		ret = dev_err_probe(scm->dev, ret,
-				    "Failed to enable the TrustZone memory allocator\n");
-		goto err_rmem;
-	}
+	if (ret)
+		return dev_err_probe(scm->dev, ret,
+				     "Failed to enable the TrustZone memory allocator\n");
 
 	memset(&pool_config, 0, sizeof(pool_config));
 	pool_config.initial_size = 0;
@@ -2797,11 +2795,9 @@ static int qcom_scm_probe(struct platform_device *pdev)
 	pool_config.max_size = SZ_256K;
 
 	scm->mempool = devm_qcom_tzmem_pool_new(scm->dev, &pool_config);
-	if (IS_ERR(scm->mempool)) {
-		ret = dev_err_probe(scm->dev, PTR_ERR(scm->mempool),
-				    "Failed to create the SCM memory pool\n");
-		goto err_rmem;
-	}
+	if (IS_ERR(scm->mempool))
+		return dev_err_probe(scm->dev, PTR_ERR(scm->mempool),
+				     "Failed to create the SCM memory pool\n");
 
 	ret = qcom_scm_query_waitq_count(scm);
 	scm->wq_cnt = ret < 0 ? QCOM_SCM_DEFAULT_WAITQ_COUNT : ret;
@@ -2872,10 +2868,6 @@ static int qcom_scm_probe(struct platform_device *pdev)
 	qcom_scm_gunyah_wdt_init(scm);
 
 	return 0;
-
-err_rmem:
-	of_reserved_mem_device_release(scm->dev);
-	return ret;
 }
 
 static void qcom_scm_shutdown(struct platform_device *pdev)
-- 
2.53.0



^ permalink raw reply related

* Re: [PATCH v16 01/18] seccomp: Convert __secure_computing() to return boolean
From: Thomas Gleixner @ 2026-07-03 20:52 UTC (permalink / raw)
  To: Kevin Brodsky, Michal Suchánek, Mark Rutland
  Cc: Jinjie Ruan, oleg, richard.henderson, mattst88, linmag7, linux,
	catalin.marinas, will, kees, guoren, chenhuacai, kernel, geert,
	tsbogend, James.Bottomley, deller, maddy, mpe, npiggin, chleroy,
	pjw, palmer, aou, alex, hca, gor, agordeev, borntraeger, svens,
	ysato, dalias, glaubitz, richard, anton.ivanov, johannes, luto,
	mingo, bp, dave.hansen, hpa, chris, jcmvbkbc, peterz, wad, thuth,
	ada.coupriediaz, linusw, yeoreum.yun, song, james.morse,
	anshuman.khandual, broonie, liqiang01, pengcan, ryan.roberts,
	yangtiezhu, sshegde, mchauras, austin.kim, jchrist, arnd,
	thomas.weissschuh, sohil.mehta, andrew.cooper3, jgross, kas, x86,
	linux-alpha, linux-kernel, linux-arm-kernel, linux-mm, linux-csky,
	loongarch, linux-m68k, linux-mips, linux-parisc, linuxppc-dev,
	linux-riscv, linux-s390, linux-sh, linux-um
In-Reply-To: <fa1f5b39-2703-40a1-81d6-3feba87e19b0@arm.com>

On Fri, Jul 03 2026 at 13:59, Kevin Brodsky wrote:
> On 03/07/2026 12:27, Michal Suchánek wrote:
>>> If we're changing the return type, it might be worth renaming the
>>> function something like:
>>>
>>> 	seccomp_permits_syscall()
>> Then not only it is clear which way the boolean value should be
>> interpreted, it also pervents the accidental inversion of existing
>> calls. Overall great.
>
> Totally agreed, if we have the opportunity to rename a completely
> undescriptive function name like "secure_computing" we should take it.

Absolutely no objections from my side on that.


^ permalink raw reply

* [PATCH 28/42] ASoC: mediatek: mt8189: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Replace the hand-rolled devm wrapper (mt8189_afe_release_reserved_mem +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource manager
handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
index 77cf2b604f6c..04baf7d9132a 100644
--- a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
+++ b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
@@ -2421,11 +2421,6 @@ static const struct reg_sequence mt8189_cg_patch[] = {
 	{ AUDIO_TOP_CON4, 0x361c },
 };
 
-static void mt8189_afe_release_reserved_mem(void *data)
-{
-	of_reserved_mem_device_release(data);
-}
-
 static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev)
 {
 	int ret, i;
@@ -2439,16 +2434,9 @@ static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = of_reserved_mem_device_init(dev);
-	if (ret) {
+	ret = devm_of_reserved_mem_device_init(dev);
+	if (ret)
 		dev_warn(dev, "failed to assign memory region: %d\n", ret);
-	} else {
-		ret = devm_add_action_or_reset(dev,
-					       mt8189_afe_release_reserved_mem,
-					       dev);
-		if (ret)
-			return ret;
-	}
 
 	afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL);
 	if (!afe)
-- 
2.53.0



^ permalink raw reply related

* [PATCH 27/42] ASoC: mediatek: mt8183: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Replace the hand-rolled devm wrapper (mt8183_afe_release_reserved_mem +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource manager
handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
index 2634699534db..6ad396e3b10d 100644
--- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
+++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
@@ -766,11 +766,6 @@ static const dai_register_cb dai_register_cbs[] = {
 	mt8183_dai_memif_register,
 };
 
-static void mt8183_afe_release_reserved_mem(void *data)
-{
-	of_reserved_mem_device_release(data);
-}
-
 static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
 {
 	struct mtk_base_afe *afe;
@@ -795,16 +790,10 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
 	afe_priv = afe->platform_priv;
 	afe->dev = dev;
 
-	ret = of_reserved_mem_device_init(dev);
+	ret = devm_of_reserved_mem_device_init(dev);
 	if (ret) {
 		dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
 		afe->preallocate_buffers = true;
-	} else {
-		ret = devm_add_action_or_reset(dev,
-					       mt8183_afe_release_reserved_mem,
-					       dev);
-		if (ret)
-			return ret;
 	}
 
 	/* initial audio related clock */
-- 
2.53.0



^ permalink raw reply related

* [PATCH 26/42] ASoC: mediatek: mt8196: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Replace the hand-rolled devm wrapper (mt8196_afe_release_reserved_mem +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource manager
handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 sound/soc/mediatek/mt8196/mt8196-afe-pcm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
index a1ae8322d8b6..dcee037991aa 100644
--- a/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
+++ b/sound/soc/mediatek/mt8196/mt8196-afe-pcm.c
@@ -2309,11 +2309,6 @@ static const struct reg_sequence mt8196_cg_patch[] = {
 	{ AUDIO_TOP_CON4, 0x361c },
 };
 
-static void mt8196_afe_release_reserved_mem(void *data)
-{
-	of_reserved_mem_device_release(data);
-}
-
 static int mt8196_afe_pcm_dev_probe(struct platform_device *pdev)
 {
 	int ret, i;
@@ -2327,14 +2322,9 @@ static int mt8196_afe_pcm_dev_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = of_reserved_mem_device_init(dev);
-	if (ret) {
+	ret = devm_of_reserved_mem_device_init(dev);
+	if (ret)
 		dev_err(dev, "failed to assign memory region: %d\n", ret);
-	} else {
-		ret = devm_add_action_or_reset(dev, mt8196_afe_release_reserved_mem, dev);
-		if (ret)
-			return ret;
-	}
 
 	afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL);
 	if (!afe)
-- 
2.53.0



^ permalink raw reply related

* [PATCH 25/42] ASoC: mediatek: mt8192: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Replace the hand-rolled devm wrapper (mt8192_afe_release_reserved_mem +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource manager
handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
index db0ae44a86af..e4ecd23df180 100644
--- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
+++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
@@ -2155,11 +2155,6 @@ static const dai_register_cb dai_register_cbs[] = {
 	mt8192_dai_memif_register,
 };
 
-static void mt8192_afe_release_reserved_mem(void *data)
-{
-	of_reserved_mem_device_release(data);
-}
-
 static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
 {
 	struct mtk_base_afe *afe;
@@ -2185,14 +2180,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
 
 	afe->dev = dev;
 
-	ret = of_reserved_mem_device_init(dev);
+	ret = devm_of_reserved_mem_device_init(dev);
 	if (ret) {
 		dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
 		afe->preallocate_buffers = true;
-	} else {
-		ret = devm_add_action_or_reset(dev, mt8192_afe_release_reserved_mem, dev);
-		if (ret)
-			return ret;
 	}
 
 	/* init audio related clock */
-- 
2.53.0



^ permalink raw reply related

* [PATCH 24/42] remoteproc: ti_k3: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Replace the hand-rolled devm wrapper (k3_mem_release +
devm_add_action_or_reset) with the standard
devm_of_reserved_mem_device_init(), letting the device resource
manager handle cleanup automatically. Remove the now-unused k3_mem_release
exported symbol.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/remoteproc/ti_k3_common.c | 13 +------------
 drivers/remoteproc/ti_k3_common.h |  1 -
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c
index 3cb8ae5d72f6..f08b9e373220 100644
--- a/drivers/remoteproc/ti_k3_common.c
+++ b/drivers/remoteproc/ti_k3_common.c
@@ -458,14 +458,6 @@ int k3_rproc_of_get_memories(struct platform_device *pdev,
 }
 EXPORT_SYMBOL_GPL(k3_rproc_of_get_memories);
 
-void k3_mem_release(void *data)
-{
-	struct device *dev = data;
-
-	of_reserved_mem_device_release(dev);
-}
-EXPORT_SYMBOL_GPL(k3_mem_release);
-
 int k3_reserved_mem_init(struct k3_rproc *kproc)
 {
 	struct device *dev = kproc->dev;
@@ -486,14 +478,11 @@ int k3_reserved_mem_init(struct k3_rproc *kproc)
 	}
 
 	/* use reserved memory region 0 for vring DMA allocations */
-	ret = of_reserved_mem_device_init_by_idx(dev, np, 0);
+	ret = devm_of_reserved_mem_device_init(dev);
 	if (ret) {
 		dev_err(dev, "device cannot initialize DMA pool (%d)\n", ret);
 		return ret;
 	}
-	ret = devm_add_action_or_reset(dev, k3_mem_release, dev);
-	if (ret)
-		return ret;
 
 	num_rmems--;
 	kproc->rmem = devm_kcalloc(dev, num_rmems, sizeof(*kproc->rmem), GFP_KERNEL);
diff --git a/drivers/remoteproc/ti_k3_common.h b/drivers/remoteproc/ti_k3_common.h
index aee3c28dbe51..9a58aeb3867c 100644
--- a/drivers/remoteproc/ti_k3_common.h
+++ b/drivers/remoteproc/ti_k3_common.h
@@ -112,7 +112,6 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len,
 			bool *is_iomem);
 int k3_rproc_of_get_memories(struct platform_device *pdev,
 			     struct k3_rproc *kproc);
-void k3_mem_release(void *data);
 int k3_reserved_mem_init(struct k3_rproc *kproc);
 void k3_release_tsp(void *data);
 #endif /* REMOTEPROC_TI_K3_COMMON_H */
-- 
2.53.0



^ permalink raw reply related

* [PATCH 23/42] mmc: sdhci-of-bst: Use devm_of_reserved_mem_device_init_by_idx()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Use the devres-managed devm_of_reserved_mem_device_init_by_idx() instead
of the manual of_reserved_mem_device_init_by_idx()/
of_reserved_mem_device_release() pair, letting the device resource
manager handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/mmc/host/sdhci-of-bst.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-bst.c b/drivers/mmc/host/sdhci-of-bst.c
index f8d3df715e1a..304554ced690 100644
--- a/drivers/mmc/host/sdhci-of-bst.c
+++ b/drivers/mmc/host/sdhci-of-bst.c
@@ -405,7 +405,6 @@ static void sdhci_bst_free_bounce_buffer(struct sdhci_host *host)
 				  host->bounce_buffer, host->bounce_addr);
 		host->bounce_buffer = NULL;
 	}
-	of_reserved_mem_device_release(mmc_dev(host->mmc));
 }
 
 static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
@@ -417,7 +416,7 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
 	/* Fixed SRAM bounce size to 32KB: verified config under 32-bit DMA addressing limit */
 	bounce_size = SZ_32K;
 
-	ret = of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
+	ret = devm_of_reserved_mem_device_init_by_idx(mmc_dev(mmc), mmc_dev(mmc)->of_node, 0);
 	if (ret) {
 		dev_err(mmc_dev(mmc), "Failed to initialize reserved memory\n");
 		return ret;
@@ -425,10 +424,8 @@ static int sdhci_bst_alloc_bounce_buffer(struct sdhci_host *host)
 
 	host->bounce_buffer = dma_alloc_coherent(mmc_dev(mmc), bounce_size,
 						 &host->bounce_addr, GFP_KERNEL);
-	if (!host->bounce_buffer) {
-		of_reserved_mem_device_release(mmc_dev(mmc));
+	if (!host->bounce_buffer)
 		return -ENOMEM;
-	}
 
 	host->bounce_buffer_size = bounce_size;
 
-- 
2.53.0



^ permalink raw reply related

* [PATCH 22/42] media: mediatek: vpu: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Use the devres-managed devm_of_reserved_mem_device_init() instead of
the manual of_reserved_mem_device_init()/of_reserved_mem_device_release()
pair, letting the device resource manager handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/media/platform/mediatek/vpu/mtk_vpu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
index 8d8319f0cd22..557bffb2c2f1 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
@@ -888,7 +888,7 @@ static int mtk_vpu_probe(struct platform_device *pdev)
 	dev_info(dev, "4GB mode %u\n", vpu->enable_4GB);
 
 	if (vpu->enable_4GB) {
-		ret = of_reserved_mem_device_init(dev);
+		ret = devm_of_reserved_mem_device_init(dev);
 		if (ret)
 			dev_info(dev, "init reserved memory failed\n");
 			/* continue to use dynamic allocation if failed */
@@ -930,7 +930,6 @@ static int mtk_vpu_probe(struct platform_device *pdev)
 free_d_mem:
 	vpu_free_ext_mem(vpu, D_FW);
 remove_debugfs:
-	of_reserved_mem_device_release(dev);
 #ifdef CONFIG_DEBUG_FS
 	debugfs_remove(vpu_debugfs);
 #endif
-- 
2.53.0



^ permalink raw reply related

* [PATCH 21/42] media: arm: mali-c55: Use devm_of_reserved_mem_device_init()
From: Mukesh Ojha @ 2026-07-03 19:38 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Liviu Dudau, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Stanley, Andrew Jeffery, Paul Cercueil, Anitha Chrisanthus,
	Paul Kocialkowski, Linus Walleij, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Alexey Brodkin, Laurent Pinchart, Tomi Valkeinen,
	Michal Simek, Daniel Scally, Jacopo Mondi, Mauro Carvalho Chehab,
	Eddie James, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Minghsiu Tsai, Houlong Wei, Matthias Brugger,
	AngeloGioacchino Del Regno, Joseph Liu, Marvin Lin,
	Dmitry Osipenko, Krzysztof Kozlowski, Thierry Reding,
	Jonathan Hunter, Srinivas Kandagatla, Arnd Bergmann,
	Greg Kroah-Hartman, Ge Gordon, Adrian Hunter, Ulf Hansson,
	Rob Herring, Saravana Kannan, Mathieu Poirier, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Liam Girdwood, Mark Brown,
	Frank Li, Sascha Hauer, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Orson Zhai, Baolin Wang, Peter Chen, Fugang Duan
  Cc: Ekansh Gupta, BST Linux Kernel Upstream Group, Fabio Estevam,
	Nicolin Chen, Pengutronix Kernel Team, Kai Vehmanen,
	Pierre-Louis Bossart, Vijendar Mukunda, Chunyan Zhang,
	CIX Linux Kernel Upstream Group, linux-arm-msm, linux-kernel,
	dri-devel, linux-aspeed, linux-arm-kernel, linux-mips,
	linux-sunxi, linux-media, openbmc, linux-mediatek, kernel,
	linux-tegra, linux-mmc, devicetree, linux-remoteproc,
	linux-staging, linux-sound, linuxppc-dev, imx,
	sound-open-firmware, Mukesh Ojha
In-Reply-To: <20260703193855.110619-1-mukesh.ojha@oss.qualcomm.com>

Use the devres-managed devm_of_reserved_mem_device_init() instead of
the manual of_reserved_mem_device_init()/of_reserved_mem_device_release()
pair, letting the device resource manager handle cleanup automatically.

Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/media/platform/arm/mali-c55/mali-c55-core.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-core.c b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
index 94a389b3f833..afbec11f69f8 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-core.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-core.c
@@ -801,14 +801,12 @@ static int mali_c55_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to acquire resets\n");
 
-	of_reserved_mem_device_init(dev);
+	devm_of_reserved_mem_device_init(dev);
 	vb2_dma_contig_set_max_seg_size(dev, UINT_MAX);
 
 	ret = __mali_c55_power_on(mali_c55);
-	if (ret) {
-		dev_err_probe(dev, ret, "failed to power on\n");
-		goto err_release_mem;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to power on\n");
 
 	ret = mali_c55_check_hwcfg(mali_c55);
 	if (ret)
@@ -847,9 +845,6 @@ static int mali_c55_probe(struct platform_device *pdev)
 	kfree(mali_c55->context.registers);
 err_power_off:
 	__mali_c55_power_off(mali_c55);
-err_release_mem:
-	of_reserved_mem_device_release(dev);
-
 	return ret;
 }
 
@@ -864,7 +859,6 @@ static void mali_c55_remove(struct platform_device *pdev)
 	}
 	pm_runtime_disable(&pdev->dev);
 	kfree(mali_c55->context.registers);
-	of_reserved_mem_device_release(&pdev->dev);
 }
 
 static const struct of_device_id mali_c55_of_match[] = {
-- 
2.53.0



^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox