Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp360710pxb; Wed, 14 Apr 2021 17:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBwqA9z0YswxW6yxChoDNzlMOE2toLBXxLvGI7cpmBEELTs6xYNDb+H0rVDSoW7gv8SVHm X-Received: by 2002:a17:906:6789:: with SMTP id q9mr754545ejp.295.1618447821210; Wed, 14 Apr 2021 17:50:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618447821; cv=pass; d=google.com; s=arc-20160816; b=tVXz6sk8P2C1SoaXXh9xEEoXFVd+4/kAaqGvgqzgJN5bIH1y6awucu1oW8opQXz9Rh pojvpq3vIRmi8JK5cDp5zoaLMx6BdDRIkVtR+9jtxoM6CIIokxKnt3uyrVO2SyAkgWCD j4MeTA8/346Tv8K6iatYUcBvPBPnvwMHAFepqKPH+jWBFJo2XKB/1PyHTIzD83I/UbTQ 0iTttqh5dtK6PNgdcemX/P5neOhoL4C1LkitP3RSyHxHOwp0sa29FAYD+Xo6iONle6t8 q7VrHSGA/CYjFoBpRCZy8m6nLWMuwg1mjsM+T4p3fwijH3O21cs+zyqNDMtxvDCeSt/r 70PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=Dv1LxNfBya9qpX+CAeFYpZ6KAQ6nQRLYrM1n3Lj2sPM=; b=XZHvuz4AWkzrwOZveCrr2VP2XuDJ3hGtSWZyMugxm71wdFsZ9jo2yg3PUC7+gRum0R 3U1gYuUJoXzwnR3vlhswYb2lkq4v4MdVE9y+dj2+FOCQa0pUQbaB7Jia2eWcVoVyPbqx 5MoyqiDuAcav7wDNkbh3XK/262p7zJ3Zo5ObrWP1KObTLISEuwTq+Uo6Z9QKtHTW7lGe whME23WUQ0JwBhDxHtyLNwjUzUzM3fDqxjxYCkMD9a5iewT9K7IcxZiBMwpiqw+IP+cP wKKh3EjXhjvaNXBb312cSG/OAtzdCjyPEsrvTwEunblzfr6+hS+6F3fnqeaO63p+i6cY IDEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Mrjb1anx; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=NONE sp=NONE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rp20si757182ejb.524.2021.04.14.17.49.58; Wed, 14 Apr 2021 17:50:21 -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; dkim=pass header.i=@amd.com header.s=selector1 header.b=Mrjb1anx; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=NONE sp=NONE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233544AbhDNWso (ORCPT + 99 others); Wed, 14 Apr 2021 18:48:44 -0400 Received: from mail-dm6nam11on2067.outbound.protection.outlook.com ([40.107.223.67]:23392 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232276AbhDNWsm (ORCPT ); Wed, 14 Apr 2021 18:48:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JyvLYoKMeFcuDkqQBfLy3qmxZ367gCKFVlTW9wFN5oe3iPl3wd3b3k6QtgWcFKnVHhDs4NzPguAWOkHr3Q8maUhhgqH145znn/p0+TpoNLkCxFGkT3GlTzn/kM4G5AsrF0HozbESx4O8sQcWZytaDyfwzr8LAWE/BjrWdsg/uroNUbiMquKUTuKGGGuOzduv/zaQOvos7mj/oospQoYlTL8xEZ0G5CR6x9QhdgJUoL1lSqTUO7y2Cow9T4beB5Q0puRGmuH05mWyut3AHSxcN7MJTpIhFLrtzUJYVB0VH2JKbIgM/Xl6pM8chylfjvUN2yMD77FtyYCERTWH9RQTvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dv1LxNfBya9qpX+CAeFYpZ6KAQ6nQRLYrM1n3Lj2sPM=; b=HXkWG4IBK6/OaGYtp9OkxeERKEV8RFiC1mQb2VdtUx+ksaq7FqIUTnfJtCDqCNuQzyeYgUwGK3qUnOhf+etumnnlIPPsYhlX1fpS6hHeCDMMLIZp8r5akrWWNiN6qRXv7dQ3DVO+LpHn9ARHOLX6tgRaJT6+RJZ/Kfh9R2YrNYexs81ilw1JBrtWDyibmpkqxrlvbJkR21WPcYD1dJd4xQpi2IhuZvp4JIi8LGRSjOiuwIPH7W9bpC8LEpqCTdXMxV4H7vMl/fybHo5sXmCSXYYSuh6gnC8JS9hbTi7UsawD4zjwRxGcdo7Alnkiqfisfp/5AsrWQxpdPGnX3D0WHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dv1LxNfBya9qpX+CAeFYpZ6KAQ6nQRLYrM1n3Lj2sPM=; b=Mrjb1anxYvGOftvdJ1MWfP0hsP2u1ATtvjy+u9UrapNMH3zd4RG94F/Z0vtH5d/ri2aHI8y7oGUEV+XqSsfvsGsC0oS+DpT0+BxsDQjShr0WNfa5ShK0Md5hWzlCZt9FraXl8UtMM2RKNkd9P5P/CLYOvsxW32dsEl49jok6r6M= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4058.namprd12.prod.outlook.com (2603:10b6:5:21d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16; Wed, 14 Apr 2021 22:48:18 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::b914:4704:ad6f:aba9]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::b914:4704:ad6f:aba9%12]) with mapi id 15.20.4020.022; Wed, 14 Apr 2021 22:48:18 +0000 Subject: Re: [PATCH] crypto: ccp - Fix to return the correct return value To: Tian Tao , herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-crypto@vger.kernel.org, John Allen References: <1618391864-55601-1-git-send-email-tiantao6@hisilicon.com> From: Tom Lendacky Message-ID: Date: Wed, 14 Apr 2021 17:48:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: <1618391864-55601-1-git-send-email-tiantao6@hisilicon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [67.79.209.213] X-ClientProxiedBy: SA0PR11CA0088.namprd11.prod.outlook.com (2603:10b6:806:d2::33) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from office-linux.texastahm.com (67.79.209.213) by SA0PR11CA0088.namprd11.prod.outlook.com (2603:10b6:806:d2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Wed, 14 Apr 2021 22:48:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7565d96c-8a05-4559-4daa-08d8ff9764f8 X-MS-TrafficTypeDiagnostic: DM6PR12MB4058: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VZpW+M5EIOn2HJ0I2Idgq4W+8+2y0SsFkcxeyDznGyIt6vYLo5iTwetrtn/Sgk0WWKSSOVaiDfl6Ne0MAHjTDdzDt5hfo7YB/vdfbZ6aVPpUujKRgSti+vsFCMks3Ao1pXdNhksAE0sh8B2PPLz2lhnzw7AJTdz6ngHLRkX8lL4BGJ2Us+pDJCMi2uo7VLSMZhRFf39Pm6sr6stlz/sRtmzes5Ek+Tfnnidh0kb7BKF53blQWi+QenfjzaEyM9C/uxnJvGW3rPsnAEzMQabTeLpf0eUYn0P/sHAlKT8JcD5Gl/ZhbgUp6qt6Zm7RUaS/HHGyGopAwOo8KmvmQIfuwbcYujZs42e0AtFk8om4GBqwIiONKR4/45TSSy3zomGP6GHCTvl7t+s1Q4wPYmcszePievnS6dZO+hleGMxBACl9cDUicf0agGcnPyqdO0NaV6txrfLxzYfO7J56AXahSnDYA98ZGRB/+kmsm+OtX6k6bLxlm4Yi1BvIV/mGSsbN+zBuFjOdVD5oWrsTqFQxE7nD7CxOsEEBZXUWm7W6Wa4k1BBjACaYBIQyJI6hYOoLYiKCsPhClYk35sxDPwMzsvcdBYE+fgxT/+xt9CyC8jVWQQiRLezgwxTvDY60T6qAMYHK7ZX6w0xMlY5p355ufpmRyBieQHqwXC8S6ZF8jNMDDzB/V29x1tB9PBld8Cq2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39860400002)(366004)(376002)(136003)(396003)(5660300002)(26005)(478600001)(83380400001)(36756003)(31696002)(186003)(8936002)(316002)(6512007)(4326008)(31686004)(956004)(66556008)(66476007)(66946007)(2906002)(6486002)(8676002)(38100700002)(53546011)(6506007)(16526019)(86362001)(2616005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?bGUwZHRhdXVKaEdUMWEyTzdIamNhZDVoNEYrNzBOZ3VOenlrbFA4MmJ3OG1u?= =?utf-8?B?TEV0SWZKcW1oZzM1OS84aTNyOVBKbldNZWZjbUVCb3dycnNUUlRqUkV6V1Ix?= =?utf-8?B?UXFsWEgrZE5DVGRzWXkxNVU3RHAzSnZkZE10aW1GMHJuMzlnbXlXUjk3YjZD?= =?utf-8?B?Y2dqSjhLZWlwQkdUb1RuVElVWmpybzhSWitDakFKNlQ3Q1YwUkQ5SERaOEVz?= =?utf-8?B?TWhxcHR3NmtwYTVkZ3YxRDFHM2hRdXU0WlBpTlUvL3pzQkVDOUdJV0NtaDhR?= =?utf-8?B?eFlJL002Z1BtYzU3WSsrcWo4YXhEeUQ2dTVuaU1Tbzltd3Fkdk1RVlYydGk0?= =?utf-8?B?cFllVnhmZ09STjN0UFIraVJydzkxemlBTW45a05XSGN6QlRHL2Z3eEZLR3Bx?= =?utf-8?B?RTdNMzdRclZZeDE5ZC9wMmNBVHB1dEU1OTVucCtaRXJPTlRqQzJKV3E1SVNM?= =?utf-8?B?TzkwSWVGRWk5dTFKM0FMVFFGa21Qcy9MbUt3b0xOc3A4ZVBib284OUcvMFZa?= =?utf-8?B?MVJRYlFITzZFMGtCOWZuVDdKRDFUa1RDUkF3V0JBRzZmQ3p0T1lqaGYzNjBs?= =?utf-8?B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QmM5bGMv?= =?utf-8?B?b255RDJybS9XYytkb2JodHF1SEx1TnBWTithQkpkengveCtCYkdDL09mNWFy?= =?utf-8?B?blZWa09zU3dKVnRKbGd0SkVzWFA0TEVHVkRWbmVyWk1rbzdVWG56cnlwdi9O?= =?utf-8?B?M2czY01HYVJjZUQ2YmtaT0xKOG1wbTJLTlMzSkk1Y0NLeTRoU0o4M0JYRVdS?= =?utf-8?B?dHBQQWdoOGdpUWdpWGhxSE42WFRWWCtieVdJNllUdGxDaDQ3LzlrbXlCbVNZ?= =?utf-8?Q?AynoARC7/0XqP0DpB2NozMbZe7wFOtVOWD6RP4P?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7565d96c-8a05-4559-4daa-08d8ff9764f8 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2021 22:48:17.9690 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uJ2kuTFFo0SAo0aW2L4Kxv9c8GSbxAYUzTrz0k+yE/ogBcfYI53HiusIOluqh8bH9hVGMBREv+aHtjB1Fn6xXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4058 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 > --- > 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); > >