* [PATCH] crypto: ccp - Fix to return the correct return value
@ 2021-04-14 9:17 Tian Tao
2021-04-14 22:48 ` Tom Lendacky
0 siblings, 1 reply; 3+ messages in thread
From: Tian Tao @ 2021-04-14 9:17 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-crypto, Tian Tao
ccp_dev_suspend and ccp_dev_resume return 0 on error, which causes
ret to equal 0 in sp_suspend and sp_resume, making the if condition
impossible to use.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/crypto/ccp/ccp-dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index 0971ee6..6f2af7b 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -556,7 +556,7 @@ int ccp_dev_suspend(struct sp_device *sp)
/* If there's no device there's nothing to do */
if (!ccp)
- return 0;
+ return -ENXIO;
spin_lock_irqsave(&ccp->cmd_lock, flags);
@@ -584,7 +584,7 @@ int ccp_dev_resume(struct sp_device *sp)
/* If there's no device there's nothing to do */
if (!ccp)
- return 0;
+ return -ENXIO;
spin_lock_irqsave(&ccp->cmd_lock, flags);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: ccp - Fix to return the correct return value
2021-04-14 9:17 [PATCH] crypto: ccp - Fix to return the correct return value Tian Tao
@ 2021-04-14 22:48 ` Tom Lendacky
2021-04-15 3:37 ` tiantao (H)
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lendacky @ 2021-04-14 22:48 UTC (permalink / raw)
To: Tian Tao, herbert, davem; +Cc: linux-crypto, John Allen
On 4/14/21 4:17 AM, Tian Tao wrote:
> ccp_dev_suspend and ccp_dev_resume return 0 on error, which causes
> ret to equal 0 in sp_suspend and sp_resume, making the if condition
> impossible to use.
Why do you think that is an error and why do you think it should return
-ENXIO? Since ccp_dev_suspend() and ccp_dev_resume() only return 0 it
might be a more appropriate fix to have these be void functions and
eliminate the if condition in sp_suspend() and sp_resume().
Thanks,
Tom
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
> drivers/crypto/ccp/ccp-dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
> index 0971ee6..6f2af7b 100644
> --- a/drivers/crypto/ccp/ccp-dev.c
> +++ b/drivers/crypto/ccp/ccp-dev.c
> @@ -556,7 +556,7 @@ int ccp_dev_suspend(struct sp_device *sp)
>
> /* If there's no device there's nothing to do */
> if (!ccp)
> - return 0;
> + return -ENXIO;
>
> spin_lock_irqsave(&ccp->cmd_lock, flags);
>
> @@ -584,7 +584,7 @@ int ccp_dev_resume(struct sp_device *sp)
>
> /* If there's no device there's nothing to do */
> if (!ccp)
> - return 0;
> + return -ENXIO;
>
> spin_lock_irqsave(&ccp->cmd_lock, flags);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: ccp - Fix to return the correct return value
2021-04-14 22:48 ` Tom Lendacky
@ 2021-04-15 3:37 ` tiantao (H)
0 siblings, 0 replies; 3+ messages in thread
From: tiantao (H) @ 2021-04-15 3:37 UTC (permalink / raw)
To: Tom Lendacky, Tian Tao, herbert, davem; +Cc: linux-crypto, John Allen
在 2021/4/15 6:48, Tom Lendacky 写道:
> On 4/14/21 4:17 AM, Tian Tao wrote:
>> ccp_dev_suspend and ccp_dev_resume return 0 on error, which causes
>> ret to equal 0 in sp_suspend and sp_resume, making the if condition
>> impossible to use.
> Why do you think that is an error and why do you think it should return
> -ENXIO? Since ccp_dev_suspend() and ccp_dev_resume() only return 0 it
thank you for helping reivew.
I think that ccp equals null might just be wrong, now after listening to
your
explanation, my understanding was wrong, I will send a new patch as you
suggested.
> might be a more appropriate fix to have these be void functions and
> eliminate the if condition in sp_suspend() and sp_resume().
>
> Thanks,
> Tom
>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> ---
>> drivers/crypto/ccp/ccp-dev.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
>> index 0971ee6..6f2af7b 100644
>> --- a/drivers/crypto/ccp/ccp-dev.c
>> +++ b/drivers/crypto/ccp/ccp-dev.c
>> @@ -556,7 +556,7 @@ int ccp_dev_suspend(struct sp_device *sp)
>>
>> /* If there's no device there's nothing to do */
>> if (!ccp)
>> - return 0;
>> + return -ENXIO;
>>
>> spin_lock_irqsave(&ccp->cmd_lock, flags);
>>
>> @@ -584,7 +584,7 @@ int ccp_dev_resume(struct sp_device *sp)
>>
>> /* If there's no device there's nothing to do */
>> if (!ccp)
>> - return 0;
>> + return -ENXIO;
>>
>> spin_lock_irqsave(&ccp->cmd_lock, flags);
>>
>>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-15 3:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 9:17 [PATCH] crypto: ccp - Fix to return the correct return value Tian Tao
2021-04-14 22:48 ` Tom Lendacky
2021-04-15 3:37 ` tiantao (H)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.