diff mbox series

[3/3] lib: sbi_ipi: Drop unnecessary ipi_process check

Message ID 20231208212301.3649930-4-samuel.holland@sifive.com
State Accepted
Headers show
Series sbi_ipi bug fixes and optimizations | expand

Commit Message

Samuel Holland Dec. 8, 2023, 9:22 p.m. UTC
sbi_ipi_event_create() disallows registering an IPI event with a NULL
.process callback, so the function pointer will never be NULL here.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---

 lib/sbi/sbi_ipi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anup Patel Dec. 10, 2023, 4:59 a.m. UTC | #1
On Sat, Dec 9, 2023 at 2:53 AM Samuel Holland <samuel.holland@sifive.com> wrote:
>
> sbi_ipi_event_create() disallows registering an IPI event with a NULL
> .process callback, so the function pointer will never be NULL here.
>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>
>  lib/sbi/sbi_ipi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
> index ac31cd94..1115912b 100644
> --- a/lib/sbi/sbi_ipi.c
> +++ b/lib/sbi/sbi_ipi.c
> @@ -241,7 +241,7 @@ void sbi_ipi_process(void)
>         while (ipi_type) {
>                 if (ipi_type & 1UL) {
>                         ipi_ops = ipi_ops_array[ipi_event];
> -                       if (ipi_ops && ipi_ops->process)
> +                       if (ipi_ops)
>                                 ipi_ops->process(scratch);
>                 }
>                 ipi_type = ipi_type >> 1;
> --
> 2.42.0
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
Xiang W Dec. 11, 2023, 7:28 a.m. UTC | #2
在 2023-12-08星期五的 13:22 -0800,Samuel Holland写道:
> sbi_ipi_event_create() disallows registering an IPI event with a NULL
> .process callback, so the function pointer will never be NULL here.
> 
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
LGTM

Reviewed-by: Xiang W <wxjstz@126.com>
> ---
> 
>  lib/sbi/sbi_ipi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
> index ac31cd94..1115912b 100644
> --- a/lib/sbi/sbi_ipi.c
> +++ b/lib/sbi/sbi_ipi.c
> @@ -241,7 +241,7 @@ void sbi_ipi_process(void)
>  	while (ipi_type) {
>  		if (ipi_type & 1UL) {
>  			ipi_ops = ipi_ops_array[ipi_event];
> -			if (ipi_ops && ipi_ops->process)
> +			if (ipi_ops)
>  				ipi_ops->process(scratch);
>  		}
>  		ipi_type = ipi_type >> 1;
> -- 
> 2.42.0
> 
>
Anup Patel Dec. 18, 2023, 5:15 p.m. UTC | #3
On Sat, Dec 9, 2023 at 2:53 AM Samuel Holland <samuel.holland@sifive.com> wrote:
>
> sbi_ipi_event_create() disallows registering an IPI event with a NULL
> .process callback, so the function pointer will never be NULL here.
>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup


> ---
>
>  lib/sbi/sbi_ipi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
> index ac31cd94..1115912b 100644
> --- a/lib/sbi/sbi_ipi.c
> +++ b/lib/sbi/sbi_ipi.c
> @@ -241,7 +241,7 @@ void sbi_ipi_process(void)
>         while (ipi_type) {
>                 if (ipi_type & 1UL) {
>                         ipi_ops = ipi_ops_array[ipi_event];
> -                       if (ipi_ops && ipi_ops->process)
> +                       if (ipi_ops)
>                                 ipi_ops->process(scratch);
>                 }
>                 ipi_type = ipi_type >> 1;
> --
> 2.42.0
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
index ac31cd94..1115912b 100644
--- a/lib/sbi/sbi_ipi.c
+++ b/lib/sbi/sbi_ipi.c
@@ -241,7 +241,7 @@  void sbi_ipi_process(void)
 	while (ipi_type) {
 		if (ipi_type & 1UL) {
 			ipi_ops = ipi_ops_array[ipi_event];
-			if (ipi_ops && ipi_ops->process)
+			if (ipi_ops)
 				ipi_ops->process(scratch);
 		}
 		ipi_type = ipi_type >> 1;