Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp439703pxb; Wed, 14 Apr 2021 20:38:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw47Oqg++5aO+aglHYRzZZ48MTsd8VO1GTqb7Oxh2cvWdVT8zzWea79qoiLSMYxrAjYJ/uI X-Received: by 2002:a17:906:a1c8:: with SMTP id bx8mr1187434ejb.381.1618457915576; Wed, 14 Apr 2021 20:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618457915; cv=none; d=google.com; s=arc-20160816; b=dHAXaZfgpPy5VBsW3FvDwg+sbVRhjVheg+uV8ghGuV28fGPNdbgX4r8o99JuUMpr9T BPjdYff6EsdNr0D/jU5bs+2Odsv4aorgSP+3eNnEb8gNkOD5r45CBRR4lKoq4SjYgGeP w5EPnUPW7dS64BNt4Xjf2E0uz+a90lTEs50m7QFTHkizHFkv5wudpJs8VEueANxl2Xtq +OJEVFip2knI5feoNvDOUh4ctLFwnlHIFnz62Rh1HjI0kCPoKBgh/K8Lc1kL65XBRit7 pxrPemrdhMwfE6GSdpmK/46ysroFA4cXmalrTyu4DFunvXMpIHetL/IpkIn+/1o+wDDM BJ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=TeRQne88DU7OElkAPTfHi9NhP33T6Krcjqxs4gOvRaY=; b=DTyy8Cx2zt1mcGIAJD8JQhvuV2o190MbHEnMzUnCWH0QYBaAvkaxXnRRHCh1+cV3Ff cqKo8PTe7UOQjoIru6qtBzWYC9xQdw4eC0HIib4TWCpe6tzjxZ1EeWrfATE8KNx1gfwL TGhlAgEdd/+3Kt3k61bNQwgvc5pObAaavXcE8nHMa9KUm7qbl+pp3iqAv+MRAOzW4rzA FlkazSgeikZX33UIgq/N8iyP/OnJNf9YYTIJK7l0lE+m/GrBHBQVaUc8MpZonV8a+cP5 mDUoXsnwyZzrgUJgy96OwIUYNNDKLpwAcTMBJ33NZl6ps5+S+29oU6cxESg8xIFttfWy MPzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy6si1078535ejc.261.2021.04.14.20.38.01; Wed, 14 Apr 2021 20:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229618AbhDODiT (ORCPT + 99 others); Wed, 14 Apr 2021 23:38:19 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:17337 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbhDODiS (ORCPT ); Wed, 14 Apr 2021 23:38:18 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FLQ3D6wZZzB178; Thu, 15 Apr 2021 11:35:36 +0800 (CST) Received: from [127.0.0.1] (10.40.188.144) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Thu, 15 Apr 2021 11:37:45 +0800 Subject: Re: [PATCH] crypto: ccp - Fix to return the correct return value To: Tom Lendacky , Tian Tao , , CC: , John Allen References: <1618391864-55601-1-git-send-email-tiantao6@hisilicon.com> From: "tiantao (H)" Message-ID: Date: Thu, 15 Apr 2021 11:37:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.40.188.144] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 在 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 >> --- >> 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); >> >> > . >