Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3544649pxb; Wed, 14 Apr 2021 07:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFV1H4kYIQCmrujo8U7WrUj/UVZWAU/pNRXv5QhlwMSjUEjRLKJc03PwxOPSz1zUUpzEro X-Received: by 2002:a17:906:b104:: with SMTP id u4mr37620182ejy.211.1618412173081; Wed, 14 Apr 2021 07:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618412173; cv=none; d=google.com; s=arc-20160816; b=qdVTbzSW9fyx1muzF8Op3qsHlCmEAyJfTjIoALtKOCq9Q9E4m9+Ul50it/tKYvAcVq SozH30nvMNwzH2viI1NJt8calW1cK4D15vZH+4bh2Xfl6t4Xnn+BsofFyAKIh9r11wLN tOsK/EYOOXoY2KDL3XOOMNwrAsoeHPSWvydVMiZ3HihjG4mmRqcPhIzvNoWOZLa50Khj TiWNhzckmCOjpNsXcsVb/FlZeEb6dKl8U4h3K1GvhqFnkLu/ngQrPiTZnPjQaCUWxnat yubVltP2ffdcla8MfZTfxI37caKNXQ72Ok927HJP4hMIA2I1Z13nBVHGSY3A+GtkweHT rTBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=7991Q52rfuNa0DhYzArXOaQk1/xC07wgKCURILCHvys=; b=FsnDMm2qJas1qNzM6Auqkb4/ezHNPJEH9t1BJJ+fDgx8FOkPOBaD5MEXS2cjj5Wice f4v4QzknApv+8Zvxglxk74+ZCtGRw1ZDVmEIZ+yA40kVi2eYCNjk+bCMyVN5cWvH/5O0 LON/0ilQcTxZT3P0y2w7jpqeDFAId4QSzTvuw1oCtfCRvZHtgwyy/jU4xEHF4EoHfzYE qO7drhdpytsJJ09niVDADgFtb1QrpmZ8GJGCBCw7togMh8qf0tzDhgp4d4LuAQGpbLSq KiQj6QU4dWVCqEC297UVS8T6sytxa0fUFGSvQi3xUzAuuxkf7FlwygWWQE3GAzt5MMj3 YAqQ== 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=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si11307660edz.507.2021.04.14.07.55.39; Wed, 14 Apr 2021 07:56:13 -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=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232755AbhDNJRy (ORCPT + 99 others); Wed, 14 Apr 2021 05:17:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:15677 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbhDNJRy (ORCPT ); Wed, 14 Apr 2021 05:17:54 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FKxct19WTzpXfC; Wed, 14 Apr 2021 17:14:38 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Wed, 14 Apr 2021 17:17:23 +0800 From: Tian Tao To: , CC: , Tian Tao Subject: [PATCH] crypto: ccp - Fix to return the correct return value Date: Wed, 14 Apr 2021 17:17:44 +0800 Message-ID: <1618391864-55601-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- 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