From patchwork Thu Jan 9 12:53:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 11325605 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC27413A0 for ; Thu, 9 Jan 2020 12:54:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C008C2075D for ; Thu, 9 Jan 2020 12:54:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="P6s9RhZT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbgAIMyA (ORCPT ); Thu, 9 Jan 2020 07:54:00 -0500 Received: from mail-bn8nam11on2058.outbound.protection.outlook.com ([40.107.236.58]:11563 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728298AbgAIMx7 (ORCPT ); Thu, 9 Jan 2020 07:53:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nldS72QDxkSwowlvLLPwNsYb5p5OzOjHefz5T4lzjoNQKzyNLDRYUrKACnQqqEAzLDMhBHr6//Jm1wzzuPKOf7ehGjEK0ZwdXEBNqjksLNQrcEwGy8MticdvLivk2HXh/CormuQjMSLYEfESpyJkuMwPmCcFhkvlZuef/TIktsuoRJiJSD4Pr8ZSFYepV7lVEOjaM5Q8ZpHNrjUeZ1qi0D9RW6z8EKVdpF6dbmAXrH5Jl1w835vjD3SG2J0cXKnIZLmcoU+MLorttwvHkD2GOXCxqkrYBK7pA3vrnCzv9wq0NgBtmwBcRKK7UGgP/yhVZFQxYTTVGUtEE8Ylbb+K4w== 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=nwLnvxQvL09QSekUQx4GqADuo3iuHwWaAQT24rStps8=; b=XSJGrfniOS+ZTY3J9gPt15mzd0kYPtMx/GpMnXQb226vBsIgiSDl+F1GkE9+J/kBhTCYQGAvzn5BD7m0bAwTPDa9l19FTMBMRSpPwUkDgHE6w+pfi0NjAwKc1GXVsEwLL5b6efVy7mI/uTi80znbAISz4EdWuw55YvcBL0WWvCVR14mYqBc8uOCLCEErU3bNupnLbfDsLEBKIz9TEbx+/9Xha8r/AeEZjL7aU0Px0V8er1EUYQ67i5Yn/qrYKp9TEb9PkzMY5J28+lxrh+K4O3SokQvf/4/bTpgZzPKF/1VIWq2P75DD95Rd3MhQHYVGJ8DkW7ihn5XegZoO9anx1A== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nwLnvxQvL09QSekUQx4GqADuo3iuHwWaAQT24rStps8=; b=P6s9RhZT/qcf9vRKV+cQVSC529enPQ1+ophu5xSRQ/RodukqJPEVMRop8n+5ehTX1CT2PAAubye4Lnx2kra2SuYXpAB+eppoCyDAiZKIhPKebz6w5WoW3akHJq6qC8OaHiiL4/UuikCenBaCs1gJhrO+LuGct5RD+58EgHQzLVQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rijo-john.Thomas@amd.com; Received: from CY4PR12MB1925.namprd12.prod.outlook.com (10.175.62.7) by CY4PR12MB1206.namprd12.prod.outlook.com (10.168.166.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 9 Jan 2020 12:53:56 +0000 Received: from CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2]) by CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2%3]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 12:53:56 +0000 From: Rijo Thomas To: Jens Wiklander , Herbert Xu , Gary R Hook , tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Nimesh Easow , Devaraj Rangasamy , Dan Carpenter Subject: [PATCH 1/5] tee: amdtee: remove unused variable initialization Date: Thu, 9 Jan 2020 18:23:18 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) To CY4PR12MB1925.namprd12.prod.outlook.com (2603:10b6:903:120::7) MIME-Version: 1.0 Received: from andbang5.amd.com (165.204.156.251) by MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 12:53:53 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d89837ff-e9d7-496c-dfea-08d79502fd1c X-MS-TrafficTypeDiagnostic: CY4PR12MB1206:|CY4PR12MB1206: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(136003)(376002)(396003)(39860400002)(189003)(199004)(6486002)(478600001)(4326008)(5660300002)(26005)(2906002)(7696005)(110136005)(54906003)(36756003)(6666004)(86362001)(52116002)(16526019)(66946007)(186003)(66556008)(66476007)(81156014)(8676002)(956004)(2616005)(81166006)(8936002)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1206;H:CY4PR12MB1925.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Whx4hWiBwmg0EynKjWM0lobJST34NcEw77KYIwAIKNOq+rESyv0cI/VYZo2F3JKE2I/qV5Ej2MJlsuF7IN4YwULECWsvAZ/6PaCSZH73tD/X/FbsBgKe50lRFy39B/3qrq+jpWsAkKcrn6FJjS4z8wwKoBs6kDFVUNnkuvKK1lWyelINDFqIqbQ28Qiv1y5ajrhmOi6ns/+Q4F4EZH4fVbXSvYEbGscIrwEScvtYfa03nLeWJy0+8Vak9IZtJEIvWqsAePs7vp2S8JxqRLjFzKfxF+MqaaofXWcQEKU7skgbC7QRGH2PuD5oWvdx88bZ6p8fDPaJklEvSfgo4N5rKACMYktiG26D/EPJ7MJE9Ckt1l2++CUNx/PVu2eqd0oCY4guQhxfAtjRbTrl/DObVx8mpvsU64+CVQkAmIMfRM/zTGMbPyiq/4z8s8OPQIFr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d89837ff-e9d7-496c-dfea-08d79502fd1c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 12:53:56.7094 (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: JjzDjXMBcKxSqBWLEa/dCBxEvUtwFP6U5PCNEXfwhoEd1ai3Xa2C1FsYvfdsxkIA+7nBdJviEsjThiRQQck6cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1206 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Remove unused variable initialization from driver code. If enabled as a compiler option, compiler may throw warning for unused assignments. Reported-by: Dan Carpenter Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/call.c | 14 +++++++------- drivers/tee/amdtee/core.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/tee/amdtee/call.c b/drivers/tee/amdtee/call.c index 87ccad256686..096dd4d92d39 100644 --- a/drivers/tee/amdtee/call.c +++ b/drivers/tee/amdtee/call.c @@ -124,8 +124,8 @@ static int amd_params_to_tee_params(struct tee_param *tee, u32 count, int handle_unload_ta(u32 ta_handle) { struct tee_cmd_unload_ta cmd = {0}; - int ret = 0; u32 status; + int ret; if (!ta_handle) return -EINVAL; @@ -145,8 +145,8 @@ int handle_unload_ta(u32 ta_handle) int handle_close_session(u32 ta_handle, u32 info) { struct tee_cmd_close_session cmd = {0}; - int ret = 0; u32 status; + int ret; if (ta_handle == 0) return -EINVAL; @@ -167,8 +167,8 @@ int handle_close_session(u32 ta_handle, u32 info) void handle_unmap_shmem(u32 buf_id) { struct tee_cmd_unmap_shared_mem cmd = {0}; - int ret = 0; u32 status; + int ret; cmd.buf_id = buf_id; @@ -183,7 +183,7 @@ int handle_invoke_cmd(struct tee_ioctl_invoke_arg *arg, u32 sinfo, struct tee_param *p) { struct tee_cmd_invoke_cmd cmd = {0}; - int ret = 0; + int ret; if (!arg || (!p && arg->num_params)) return -EINVAL; @@ -229,7 +229,7 @@ int handle_map_shmem(u32 count, struct shmem_desc *start, u32 *buf_id) { struct tee_cmd_map_shared_mem *cmd; phys_addr_t paddr; - int ret = 0, i; + int ret, i; u32 status; if (!count || !start || !buf_id) @@ -294,7 +294,7 @@ int handle_open_session(struct tee_ioctl_open_session_arg *arg, u32 *info, struct tee_param *p) { struct tee_cmd_open_session cmd = {0}; - int ret = 0; + int ret; if (!arg || !info || (!p && arg->num_params)) return -EINVAL; @@ -342,7 +342,7 @@ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg) { struct tee_cmd_load_ta cmd = {0}; phys_addr_t blob; - int ret = 0; + int ret; if (size == 0 || !data || !arg) return -EINVAL; diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index 9d0cee1c837f..b3f8235579f7 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -50,7 +50,7 @@ static int amdtee_open(struct tee_context *ctx) static void release_session(struct amdtee_session *sess) { - int i = 0; + int i; /* Close any open session */ for (i = 0; i < TEE_NUM_SESSIONS; ++i) { @@ -173,7 +173,7 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta, u16 hi_ver; u8 seq_n[8]; } *uuid = ptr; - int n = 0, rc = 0; + int n, rc = 0; n = snprintf(fw_name, TA_PATH_MAX, "%s/%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x.bin", @@ -219,9 +219,9 @@ int amdtee_open_session(struct tee_context *ctx, struct amdtee_context_data *ctxdata = ctx->data; struct amdtee_session *sess = NULL; u32 session_info; - void *ta = NULL; size_t ta_size; - int rc = 0, i; + int rc, i; + void *ta; if (arg->clnt_login != TEE_IOCTL_LOGIN_PUBLIC) { pr_err("unsupported client login method\n"); @@ -368,8 +368,8 @@ int amdtee_map_shmem(struct tee_shm *shm) void amdtee_unmap_shmem(struct tee_shm *shm) { + struct amdtee_shm_data *shmnode; u32 buf_id; - struct amdtee_shm_data *shmnode = NULL; if (!shm) return; @@ -434,9 +434,9 @@ static const struct tee_desc amdtee_desc = { static int __init amdtee_driver_init(void) { - struct amdtee *amdtee = NULL; struct tee_device *teedev; - struct tee_shm_pool *pool = ERR_PTR(-EINVAL); + struct tee_shm_pool *pool; + struct amdtee *amdtee; int rc; rc = psp_check_tee_status(); From patchwork Thu Jan 9 12:53:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 11325607 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B0B8139A for ; Thu, 9 Jan 2020 12:54:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78E202075D for ; Thu, 9 Jan 2020 12:54:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="MO0NsqM6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728733AbgAIMyC (ORCPT ); Thu, 9 Jan 2020 07:54:02 -0500 Received: from mail-eopbgr700055.outbound.protection.outlook.com ([40.107.70.55]:17825 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728298AbgAIMyC (ORCPT ); Thu, 9 Jan 2020 07:54:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M085hAj2XNd1LpX0nD/noLIRZRBZ72SVxAhXS7eBUFAlOLRCzGAiE65F42iEqO69NafFvWBX9664HhM0tMUHuqk+rd0IlWryVETsnzsHWbqy36j8hTOPT28ZR5HmINi2QJ3Whg70K2BqrBBvcP9o70qtyjXJu/qYSXe8OgGuokHOFVQ1BitWgH8oPCBz3eQun+lKs/hU3LU/yUAeEI3XcJaMyXRcF6liXktUHqA3iL8Uc6pp1DAhFpHQcSwpc5xHcHeIcC1bVb4sHk/710YxszYMPw186fQFVIjIpV57dObiacuW3KBJm6uC8q8y+T6r2Tid2FTT1o/XsvD0mVKb5Q== 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=gzt6z37LUmHKiX8m4NstU6/t6IkCdPW/3DA26Qi3r6E=; b=FwSiu8zPbrtA1w4Dp9I8TQ/J3IS9NUP5/QNos0izzP0WCGfkVbmTJcUMjw3dB1I37xZNWDxA1LSK2B6rpoxEdKdxfU5aDpFlm8FDYEvFeglUnOMyIQG0444Fvdl8Zl9wikCZX7n4jdBmZXIT0/CZ4JiJlm468aq0pz6l8sZnIS4KIUWVYODwpDLuvkpq3Vmjq1yZmxns1/l3vxSsZ66c2RIpBkr6iWvC9sEdHZtU1ZuLmWehHW+b5v0cxQaJokfA2f35YlUPdX9s5mP88wdEFXNrP2W6w+MF3VzGjsg6grxhagyajzro4m6hcu94idlssS8ckmLBjPxdv5paxQHbww== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gzt6z37LUmHKiX8m4NstU6/t6IkCdPW/3DA26Qi3r6E=; b=MO0NsqM6oFGTBPZVB1xf9ut6HCgrlt6+1zJitC4s7JINmWeaN90idRATkc2W7M+FUaHgekJfMMZJ0zikwtWydQ+2H9SYdwAE7Ko5Qj0rQy0bJHw5XOgHYBvhh1S2Kr9CCDDcvVxfBFQX+t5c9oM7UrRyxH6lM1HAdw45SkyilgA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rijo-john.Thomas@amd.com; Received: from CY4PR12MB1925.namprd12.prod.outlook.com (10.175.62.7) by CY4PR12MB1206.namprd12.prod.outlook.com (10.168.166.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 9 Jan 2020 12:54:00 +0000 Received: from CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2]) by CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2%3]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 12:54:00 +0000 From: Rijo Thomas To: Jens Wiklander , Herbert Xu , Gary R Hook , tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Nimesh Easow , Devaraj Rangasamy , Dan Carpenter Subject: [PATCH 2/5] tee: amdtee: print error message if tee not present Date: Thu, 9 Jan 2020 18:23:19 +0530 Message-Id: <00f01ee8cfd613f00153494d5b14a3061e6db760.1578572591.git.Rijo-john.Thomas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) To CY4PR12MB1925.namprd12.prod.outlook.com (2603:10b6:903:120::7) MIME-Version: 1.0 Received: from andbang5.amd.com (165.204.156.251) by MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 12:53:57 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8eec08d1-5ba4-40d8-3a87-08d79502ff05 X-MS-TrafficTypeDiagnostic: CY4PR12MB1206:|CY4PR12MB1206: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:335; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(136003)(376002)(396003)(39860400002)(189003)(199004)(6486002)(478600001)(15650500001)(4326008)(5660300002)(26005)(2906002)(7696005)(110136005)(54906003)(4744005)(36756003)(6666004)(86362001)(52116002)(16526019)(66946007)(186003)(66556008)(66476007)(81156014)(8676002)(956004)(2616005)(81166006)(8936002)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1206;H:CY4PR12MB1925.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GHHdkpKLJhi7ZIbvXsJcRiUEcSl1uMxTX/SLQSxB28BlfGmM5gby1sKZ0e5eK5FfdKwuEuOG34xuB+YjwzmTGWRfgXh++bwgZrx8RPG7foIhzAip4OJzN9NAwTGJ9+EZVJubraNAan7zXoiwCrFqbeho2ML2nXMYRdgdlPJm4if3UDqmziJFvIEcA68L/vLMe5zqDqF3sbVVFn/MZrQb1xNs2z+1q/mooovV5rI/+Mn/cDs5PV6L/HUOOJ3ZXKxGGi3UDmXwm+OLzHt1k8rOxVKFQ/A7HatpZh5c0FW9/u6q8nIgI7ZOUghA7fqnZG0P5EpSgU8Qd+fy6lnxzWWTcR+MGxfNjA8yW4CYkYByRtL6rMTZDcSSyXDeibcXNg89Z+cQSh2PGqy45sazWFdWQrKqaRc/4o/ZSOaxyD62S7U34AYWPY65d8c/PN3+Dq8e X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8eec08d1-5ba4-40d8-3a87-08d79502ff05 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 12:54:00.1278 (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: xhoBVF3w6vtJ8wVMESCiIAniuqecmlLZia9ex/uXDe2QTv04qIkWIbbdNAj1OamncwHfGZvD5ck9Y6F0CrsyTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1206 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org If there is no TEE with which the driver can communicate, then print an error message and return. Suggested-by: Dan Carpenter Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index b3f8235579f7..0840be03a3ab 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -440,8 +440,10 @@ static int __init amdtee_driver_init(void) int rc; rc = psp_check_tee_status(); - if (rc) - goto err_fail; + if (rc) { + pr_err("amd-tee driver: tee not present\n"); + return rc; + } drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL); if (IS_ERR(drv_data)) @@ -490,7 +492,6 @@ static int __init amdtee_driver_init(void) kfree(drv_data); drv_data = NULL; -err_fail: pr_err("amd-tee driver initialization failed\n"); return rc; } From patchwork Thu Jan 9 12:53:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 11325609 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89973139A for ; Thu, 9 Jan 2020 12:54:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66D8B2075D for ; Thu, 9 Jan 2020 12:54:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="uC/vT64M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728930AbgAIMyG (ORCPT ); Thu, 9 Jan 2020 07:54:06 -0500 Received: from mail-bn7nam10on2089.outbound.protection.outlook.com ([40.107.92.89]:22209 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728298AbgAIMyG (ORCPT ); Thu, 9 Jan 2020 07:54:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOISwu7MpOi7F7FPPgK52PbjHEexUqpe5acfuM+2zimTnm6s15fyS8h2fIt/lKeh3z0FtmuyDWJ/76k+WGAD2SXDEbCmHT7ywAEWY2ATYlP5FjlHiIuiIVzRUV+SaZdZBF7TRYpCGlUD1axoxm9TAHYQfARIZpGWeRyTIKZqCwUvRkoDrCv6JhORhRgoWB7C1Y78KT0o6OzvFeA4oJCCScA93Grddn48tDOe6PFwGVMj2c4dI+tZ7z4cRE61og1U9aLTiaPvwY+MIJ1eojLisCqF6z8gSGVczEOsv4vymzeCiARkEE+ViLjWh9+okZBAVUJG/mcX0CjZmgdwf8Vztg== 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=o11z9D94Tr2WkQuzV/QR7ecnjbYedWC7rreWuEiZq/A=; b=hexU4NanRJXBI8uRZ/m5G5fiSg32OvtKld3/DXCePQD+os1xAUsopF1guAafYMfLaSvlevz9/SxJGLb9WvBkBC2wij12dhBd/8EGGf+dm2kWnqKf3yg6hi0cUnPCltl2MZN7srm7pKSFwX1Hevw/1UhqgfHGxaF5VBb6z/YAQQvq3O7TbKEhYRt26MqtkjptAsGmL6FNDk2hO9AECBVh7Kn0oc4byThnq+WFpIqeUZisqfUCmz6rLuzYOJYstWk9cAFrH9w9YtdZWXJ06sK6072BF7Od1EfAAEYCeHH7RFt7RQdUX/VcCHxQ3L3ttBUBlfd/d8mjeiOeCWu8eLphsA== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o11z9D94Tr2WkQuzV/QR7ecnjbYedWC7rreWuEiZq/A=; b=uC/vT64MlrZun206ineTrkRaeOB02kFWCjpQp8S3SHletpnnZ0Lr1K2YmSk2Sa3+JOg2H57sy+FmnSwSarDVdTd7Fh/rLmBMMao1IQpTnX0YNcrzvoUdPHCGqCcJHTV3TQr0SFbzoWndPEOcfhL0fpfDsUptxGXAmP48L1xazPU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rijo-john.Thomas@amd.com; Received: from CY4PR12MB1925.namprd12.prod.outlook.com (10.175.62.7) by CY4PR12MB1704.namprd12.prod.outlook.com (10.175.60.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 9 Jan 2020 12:54:03 +0000 Received: from CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2]) by CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2%3]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 12:54:03 +0000 From: Rijo Thomas To: Jens Wiklander , Herbert Xu , Gary R Hook , tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Nimesh Easow , Devaraj Rangasamy , Dan Carpenter Subject: [PATCH 3/5] tee: amdtee: skip tee_device_unregister if tee_device_alloc fails Date: Thu, 9 Jan 2020 18:23:20 +0530 Message-Id: <845049bc920b6873f58f3e8d04514248e73f77c9.1578572591.git.Rijo-john.Thomas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) To CY4PR12MB1925.namprd12.prod.outlook.com (2603:10b6:903:120::7) MIME-Version: 1.0 Received: from andbang5.amd.com (165.204.156.251) by MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 12:54:00 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f9ce7c0c-d239-4cba-e694-08d795030106 X-MS-TrafficTypeDiagnostic: CY4PR12MB1704:|CY4PR12MB1704: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:392; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(199004)(189003)(5660300002)(36756003)(8936002)(52116002)(7696005)(316002)(54906003)(110136005)(81166006)(8676002)(81156014)(4326008)(478600001)(66946007)(956004)(66476007)(66556008)(2906002)(16526019)(186003)(26005)(2616005)(6486002)(86362001)(4744005)(6666004);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1704;H:CY4PR12MB1925.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zi9hnFLolLciLunQmNz++m0Px8YY6OV1WC5S1aKcYS0n2EeMtDBfAlRAnP98ZWrPArOmar6KChwpyLP/rD2TOVuwPHR3US84KDTp16VXKj30do6z91Ki20LoZCOLvOEcTn2dQ083zXlslfDWmVgERme2sPK1sL+iJ0wG7+treGBWfz/JHVSSjfYPJ77Fzkzgi6pVJ3jNPvbWNuf/Ie3eBAeTT7AmV6fNiZSQO+edUoSpeR4yU6SgTHU/Kz4Pz8kr60RZi+KJbK0e26uCFlr1c55009OdOwGBwj9/+YCAA4urgVpuACFtmRnZWTB/aw/yORPKcwZb6iJ+UcPtBxQp5An+ymVY9/IlaprLLRr3dgcnfOv3wa+L1cH0D3PYb1HmYf8leBiGjbbj92yy41aueppwoklwlc0o1Me5pGkCAoanD0qe+YsTuGMXNgOEe1ye X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9ce7c0c-d239-4cba-e694-08d795030106 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 12:54:03.4852 (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: WxzwrU31ZM8/5pTXS8PcqR0FAiYO/WRq2U4VcETDcBCj9NNLpvKx0j/rs2k9a+CoFpuaChk1XAVYk3pd9rApiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1704 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Currently, if tee_device_alloc() fails, then tee_device_unregister() is a no-op. Therefore, skip the function call to tee_device_unregister() by introducing a new goto label 'err_free_pool'. Reported-by: Dan Carpenter Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index 0840be03a3ab..c657b9728eae 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -465,7 +465,7 @@ static int __init amdtee_driver_init(void) teedev = tee_device_alloc(&amdtee_desc, NULL, pool, amdtee); if (IS_ERR(teedev)) { rc = PTR_ERR(teedev); - goto err; + goto err_free_pool; } amdtee->teedev = teedev; @@ -482,6 +482,8 @@ static int __init amdtee_driver_init(void) err: tee_device_unregister(amdtee->teedev); + +err_free_pool: if (pool) tee_shm_pool_free(pool); From patchwork Thu Jan 9 12:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 11325611 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE24E13A0 for ; Thu, 9 Jan 2020 12:54:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC5532077B for ; Thu, 9 Jan 2020 12:54:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="c7ZKXeus" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729249AbgAIMyJ (ORCPT ); Thu, 9 Jan 2020 07:54:09 -0500 Received: from mail-bn7nam10on2070.outbound.protection.outlook.com ([40.107.92.70]:49857 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728298AbgAIMyJ (ORCPT ); Thu, 9 Jan 2020 07:54:09 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BmYHsDzchA1y4uKjmdvtmOYly+WdoaU/x34xRQYR+ieWQfJERevvovKQUMpyvhtEzLwaXNfNfOCYL23VFyIyABnDPjuTFWfSagKMIgOwqh4yw3B5aym1jnisRiw9NK3AZl4uEFlKgEyg67bIHdaQ+MLNxcOkniRpIpV8vUztfPg6ohdLyzojFgAHpkwjyNLIWZlUfYWCKp/yp0Q7vkTSdeXTkB92ELnpD4lAAtYQodqErzupQBWhFqIeKeTMNRZnibcLSCTUZp3xB093+ZqJrbzLVxPlfEp8GisKgZ5FYZ8oD52t4i/MyZVGeSn6VkexvR6kcsDen4T+cPuVRA3TOA== 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=dCssjBtZ4QoftqFul9RHxc4tmk9S/kMnLRP+byqKOlo=; b=Tnx+x/0NcLhpJNhqfZABZZIQ0awJQdpN+1sYQ788iAKsV2Mhg2YmLFiuraxJI5TpUAx+2nnPJvbOGtjA8PtWbuSyx45Dw7lJKKyD1uKLmJbk21slDApT+tXP2Rgqh6rCCBnvr2sB3MSc7kSWbrQ2hNlgb/o5wmiRGxSq5OUA4f6WAcq1irTZdGMyUDahs7ZMITxUDMtuVDv9SDNazZJxRjVspk9M8R9RaQEV8YorfCw2mOF9HPo2nXBaX3y775IhQ5tTsHLMUPkv8k9QzIqoi7bQEgdyxCb2CB+V3+Bcii2sTU78/8g8xEq+wNelfNz7SpgLTkXdmo7LhXOysPnHRw== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dCssjBtZ4QoftqFul9RHxc4tmk9S/kMnLRP+byqKOlo=; b=c7ZKXeus6+rzxsQOSbwqBMPfRY6Dp7KFdAbFAmMwn4RClqQ2cdsm62EVNGdr5IqHAIcKn2l305pES9HFnuIEPd8aH65DZvoGYIpig/7XH1VPk6P5pA/H2/zo5TTxK+f87sGQne9Pnkzhx9CbeakVZKwxP499fevi7uT5OoU93DE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rijo-john.Thomas@amd.com; Received: from CY4PR12MB1925.namprd12.prod.outlook.com (10.175.62.7) by CY4PR12MB1704.namprd12.prod.outlook.com (10.175.60.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 9 Jan 2020 12:54:07 +0000 Received: from CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2]) by CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2%3]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 12:54:07 +0000 From: Rijo Thomas To: Jens Wiklander , Herbert Xu , Gary R Hook , tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Nimesh Easow , Devaraj Rangasamy , Dan Carpenter Subject: [PATCH 4/5] tee: amdtee: rename err label to err_device_unregister Date: Thu, 9 Jan 2020 18:23:21 +0530 Message-Id: <433e3acdf28ca06dc39bb1636c56431657b42da2.1578572591.git.Rijo-john.Thomas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) To CY4PR12MB1925.namprd12.prod.outlook.com (2603:10b6:903:120::7) MIME-Version: 1.0 Received: from andbang5.amd.com (165.204.156.251) by MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 12:54:03 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9be49e86-ddcd-4007-18aa-08d795030313 X-MS-TrafficTypeDiagnostic: CY4PR12MB1704:|CY4PR12MB1704: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(199004)(189003)(5660300002)(36756003)(8936002)(52116002)(7696005)(316002)(54906003)(110136005)(81166006)(8676002)(81156014)(4326008)(478600001)(66946007)(956004)(66476007)(66556008)(2906002)(16526019)(186003)(26005)(2616005)(6486002)(86362001)(4744005)(6666004);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1704;H:CY4PR12MB1925.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7eZA+cNbhYAA+WC47fcTV1O3n6v+W4dZFPMPu+9rEJsRfthBCbBgvc3jUm+e+YrZ2/qx5MUnuQPLewcdNO29uG0Vhhtdv/2zs1BLESbyBjRONOfMCl0jAbaDWV7RON9YP37NVBNDfA/EMg0jGThpJJerAHcoO2ch2r0dAz9euUKIWAPg2wnrV4qvRTN6wEJBaR1ZurnOHWFWQRuFk+WFn33avqWu+Q2Q7HN1RypTxyv7WtbneUB+67FuJOJKbZG3Qy6nGK5YC1Wx/rxRXaHS8KN9KlARRx+x6v7g5yrceCGbkSorDTJTB8sUbf2KzpUbSQA34A/bZpCOjI0FlmMOOqCeZjBnsechb3Hgj04zpRZyVqksZgTxVUffiqqt+9+CIJV8+G0+JCfo63Bd59uuiVE8M8cDQekjj9MI0DJ3MxJrEr6M1qvWjawHe6/KgQnV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9be49e86-ddcd-4007-18aa-08d795030313 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 12:54:06.9296 (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: oGc+lAOGPJ1OQL2i949wsi5+P3IpmkZonXk+e833HM9bPS8EhTr1d8nj1g0PO7RxhOXcrsP6tPMUbGnzmZ5xsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1704 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Rename err label to err_device_unregister for better readability. Suggested-by: Dan Carpenter Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index c657b9728eae..45402844b669 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -471,7 +471,7 @@ static int __init amdtee_driver_init(void) rc = tee_device_register(amdtee->teedev); if (rc) - goto err; + goto err_device_unregister; amdtee->pool = pool; @@ -480,7 +480,7 @@ static int __init amdtee_driver_init(void) pr_info("amd-tee driver initialization successful\n"); return 0; -err: +err_device_unregister: tee_device_unregister(amdtee->teedev); err_free_pool: From patchwork Thu Jan 9 12:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 11325613 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C67BC13A0 for ; Thu, 9 Jan 2020 12:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A39CD2077B for ; Thu, 9 Jan 2020 12:54:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="pbcP2qUh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728298AbgAIMyQ (ORCPT ); Thu, 9 Jan 2020 07:54:16 -0500 Received: from mail-co1nam11on2042.outbound.protection.outlook.com ([40.107.220.42]:21793 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729398AbgAIMyQ (ORCPT ); Thu, 9 Jan 2020 07:54:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FOIKHl0fxExfvqtwwAt8OGlLuLGja/LQgDWzuEP026Brc/iph0FRUmlV5rVg/FwX/IszhXXxinKbTW3xKrNWWwwbibpVNiDsGAoF6hhXMGjrMHQAbirhe3K0/3dZddE1xVOZDDf/tLGKoW83zbI+G/uQ0cFVaozr9VOh/J1v1JfxVpU3ajValogPsrefRZ+b5b5Bz5KBbgYj8LiJowrjHIsVu+7LNmAhMcNkwMiEkyEUx6SCdOI3z+KpqnTsxV4mWd7RYwGb6zLgrIVHfz2MudD5TQP7vpUYUgV8pb9A4LV/4k+hLKAe5PPk7uxZA4pJAgoVE+TtX+hS6R7hN8JmvA== 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=Sg97gArTgOc7dUrMMIfy6m1FxUr73enY54GrLZ9SeYw=; b=I9FURVoO+UQF44EXXDyWMbTXHn0W1GZKTBtzxwIt9ujPpgAt3nt+FCrLoQmax+RfYKSMguE7zFaIHf19HkPRF0WSlaJfLgfeyV2y+5sr5ewKO/O3WrSppAgty5ucB+L/mEBJrPPXxB4mGf8QOMZQSQc84a3uxbR5QG1i3oHuPRyr1qhjrN2psZn99r7FlN3QVMmU0qsZDf8/z/aThvw5OfbebjHZQGXBzj5HKXyWQ3PmJwWJHFDonRggINmGrlI40FvleA974yyZwZZXDSnXCQea0qlruHSISUdngb246pbS+MKywRMZiKhhJu7yf/gVuOujLTpdKxPQtvIgs9IUFQ== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sg97gArTgOc7dUrMMIfy6m1FxUr73enY54GrLZ9SeYw=; b=pbcP2qUhyDBE9x35Uroa0kud8XPnDJyNQlav/eUDWIJ0is5H0vzpVNj3bbr1fgO82e4WsTQKf453emk7Igwtyid41V9qas/yQP2vUygbRhTvga+6A2awMirBQyoZk5veYwkynjsAM0QjWu/N2ZhrACPN3BTStBgHf7gP6rXCb68= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rijo-john.Thomas@amd.com; Received: from CY4PR12MB1925.namprd12.prod.outlook.com (10.175.62.7) by CY4PR12MB1783.namprd12.prod.outlook.com (10.175.62.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.13; Thu, 9 Jan 2020 12:54:10 +0000 Received: from CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2]) by CY4PR12MB1925.namprd12.prod.outlook.com ([fe80::9be:baba:170f:3e2%3]) with mapi id 15.20.2602.018; Thu, 9 Jan 2020 12:54:10 +0000 From: Rijo Thomas To: Jens Wiklander , Herbert Xu , Gary R Hook , tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Nimesh Easow , Devaraj Rangasamy , Dan Carpenter Subject: [PATCH 5/5] tee: amdtee: remove redundant NULL check for pool Date: Thu, 9 Jan 2020 18:23:22 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) To CY4PR12MB1925.namprd12.prod.outlook.com (2603:10b6:903:120::7) MIME-Version: 1.0 Received: from andbang5.amd.com (165.204.156.251) by MA1PR01CA0119.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 12:54:07 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6d3b74ab-24ae-43d0-20cd-08d795030518 X-MS-TrafficTypeDiagnostic: CY4PR12MB1783:|CY4PR12MB1783: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(199004)(189003)(478600001)(86362001)(7696005)(4326008)(52116002)(956004)(2616005)(8936002)(2906002)(81166006)(81156014)(8676002)(6486002)(16526019)(66946007)(66556008)(316002)(36756003)(54906003)(110136005)(186003)(4744005)(26005)(6666004)(5660300002)(66476007);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1783;H:CY4PR12MB1925.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ovc31xGf0wn77h2Gsn6VDLgSB7N1Dm2qqsRqq02E5CnWctVRjMERAgrzkj1Iy7RCjGEu8Fx6au1GPYnTO+sub36npAs2itfHMHlf8YiD4+vGI34xncEIRjJneDocsDca/5azKynnnPCACPtGMmi9YW/TjyzCRfMHOkWHJzkA4j6yf5SOycQb8I0YdtwibxTYXj9I+NgDbFiJoXVDSVxKJlCCMG36N+vAAwThvyaTeE4ZJD3HYhvCb+odAvBzeFHoiA+rHKlOSiKSz5zymbjMCYqjfEecAVsjyjhyXqBQsaknQWwJbewlw9RCNpWk93DgfjCEUyhtIV8hQ548vm1UVtlVi/E744a7jf3wtEqIJmNbaUfUI0iXjC83/LWoFnSayUsPq3PnyWLeAxMu/AGh7qcetdLVb37xxKLCr+ks+/jNUzlkjtDMjCYaH8Ic/4ag X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d3b74ab-24ae-43d0-20cd-08d795030518 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 12:54:10.3030 (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: ibViy1iNZ8ER1JhucIiEXqNdSxCt6nFqDQbehc2f+2igR8rcF8Bq8LX/hhthUaRC5eKj7I3VEVIAesmmaIhAAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1783 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Remove NULL check for pool variable, since in the current code path it is guaranteed to be non-NULL. Reported-by: Dan Carpenter Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index 45402844b669..be8937eb5d43 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -484,8 +484,7 @@ static int __init amdtee_driver_init(void) tee_device_unregister(amdtee->teedev); err_free_pool: - if (pool) - tee_shm_pool_free(pool); + tee_shm_pool_free(pool); err_kfree_amdtee: kfree(amdtee);