lkml.org 
[lkml]   [2021]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: vchiq_arm: Make use of the helper macro kthread_run()
On Thu, Oct 21, 2021 at 04:43:27PM +0800, Cai Huoqing wrote:
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
> .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index a5e33da74726..6130b95aaca3 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -1717,15 +1717,12 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
> write_unlock_bh(&arm_state->susp_res_lock);
> snprintf(threadname, sizeof(threadname), "vchiq-keep/%d",
> state->id);
> - arm_state->ka_thread = kthread_create(&vchiq_keepalive_thread_func,
> - (void *)state,
> - threadname);
> + arm_state->ka_thread = kthread_run(&vchiq_keepalive_thread_func,
> + (void *)state, threadname);
> if (IS_ERR(arm_state->ka_thread)) {
> vchiq_log_error(vchiq_susp_log_level,
> "vchiq: FATAL: couldn't create thread %s",
> threadname);
> - } else {
> - wake_up_process(arm_state->ka_thread);
> }
> }
>

As others have pointed out for other busses where you sent this patch,
this is _VERY_ racy and probably wrong. Be more careful when sending
changes like this that can modify functionality without testing the
code.

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-10-22 11:04    [W:0.035 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site