Message ID | 5b89eee29b74fbafaa9df34ca3f6170d1cfc5728.1657149962.git.Thinh.Nguyen@synopsys.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: gadget: f_tcm: Enhance UASP driver | expand |
On Wed, Jul 06, 2022 at 04:35:14PM -0700, Thinh Nguyen wrote: > Minor refactoring of core_tmr_abort_task to avoid duplicate code. No > functional change here. Regardless that previous patch on that place is incorrect, this patch also breaks the statistic counters. dev->aborts_no_task counter is incremented on the end of the function, and should not be incremented for the case when command to be aborted is found. > > Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> > --- > drivers/target/target_core_tmr.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c > index 718d985e4860..3e73f60319d5 100644 > --- a/drivers/target/target_core_tmr.c > +++ b/drivers/target/target_core_tmr.c > @@ -158,15 +158,13 @@ void core_tmr_abort_task( > list_del_init(&se_cmd->state_list); > target_put_cmd_and_wait(se_cmd); > > - pr_err("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %llu\n", > - ref_tag); > - tmr->response = TMR_FUNCTION_COMPLETE; > atomic_long_inc(&dev->aborts_complete); > - return; > + goto exit; > } > spin_unlock_irqrestore(&dev->queues[i].lock, flags); > } > > +exit: > printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %lld\n", > tmr->ref_task_tag); > tmr->response = TMR_FUNCTION_COMPLETE;
On 7/7/2022, Dmitry Bogdanov wrote: > On Wed, Jul 06, 2022 at 04:35:14PM -0700, Thinh Nguyen wrote: >> Minor refactoring of core_tmr_abort_task to avoid duplicate code. No >> functional change here. > Regardless that previous patch on that place is incorrect, > this patch also breaks the statistic counters. > dev->aborts_no_task counter is incremented on the end of the function, > and should not be incremented for the case when command to be aborted is > found. Ah... I missed that. Thanks for the catch. Thinh >> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> >> --- >> drivers/target/target_core_tmr.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c >> index 718d985e4860..3e73f60319d5 100644 >> --- a/drivers/target/target_core_tmr.c >> +++ b/drivers/target/target_core_tmr.c >> @@ -158,15 +158,13 @@ void core_tmr_abort_task( >> list_del_init(&se_cmd->state_list); >> target_put_cmd_and_wait(se_cmd); >> >> - pr_err("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %llu\n", >> - ref_tag); >> - tmr->response = TMR_FUNCTION_COMPLETE; >> atomic_long_inc(&dev->aborts_complete); >> - return; >> + goto exit; >> } >> spin_unlock_irqrestore(&dev->queues[i].lock, flags); >> } >> >> +exit: >> printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %lld\n", >> tmr->ref_task_tag); >> tmr->response = TMR_FUNCTION_COMPLETE;
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 718d985e4860..3e73f60319d5 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -158,15 +158,13 @@ void core_tmr_abort_task( list_del_init(&se_cmd->state_list); target_put_cmd_and_wait(se_cmd); - pr_err("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %llu\n", - ref_tag); - tmr->response = TMR_FUNCTION_COMPLETE; atomic_long_inc(&dev->aborts_complete); - return; + goto exit; } spin_unlock_irqrestore(&dev->queues[i].lock, flags); } +exit: printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %lld\n", tmr->ref_task_tag); tmr->response = TMR_FUNCTION_COMPLETE;
Minor refactoring of core_tmr_abort_task to avoid duplicate code. No functional change here. Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> --- drivers/target/target_core_tmr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)