[PATCH 4/8] riscv: Introduce support for hardware break/watchpoints

Qingfang Deng dqfext at gmail.com
Mon Sep 1 22:13:12 PDT 2025


Hi Jesse and Charlie,

On Fri, 22 Aug 2025 10:47:11 -0700, Jesse Taube <jesse at rivosinc.com> wrote:
> +static int arch_smp_setup_sbi_shmem(unsigned int cpu)
> +{
> +	union sbi_dbtr_shmem_entry *dbtr_shmem;
> +	unsigned long shmem_pa;
> +	struct sbiret ret;
> +	int rc;
> +
> +	dbtr_shmem = per_cpu_ptr(&sbi_dbtr_shmem, cpu);
> +	if (!dbtr_shmem) {
> +		pr_err("Invalid per-cpu shared memory for debug triggers\n");
> +		return -ENODEV;
> +	}
> +
> +	shmem_pa = virt_to_phys(dbtr_shmem);
> +
> +	ret = sbi_ecall(SBI_EXT_DBTR, SBI_EXT_DBTR_SETUP_SHMEM,
> +			SBI_SHMEM_LO(shmem_pa), SBI_SHMEM_HI(shmem_pa), 0, 0, 0, 0);
> +	if (ret.error) {
> +		pr_warn("%s: failed to setup shared memory. error: %ld\n", __func__, ret.error);
> +		return sbi_err_map_linux_errno(ret.error);
> +	}
> +
> +	pr_debug("CPU %d: HW Breakpoint shared memory registered.\n", cpu);
> +
> +	return rc;

rc is uninitialized.
You may remove the variable and just return 0 here.

> +}

Regards,
Qingfang



More information about the linux-riscv mailing list