From patchwork Fri Sep 2 14:47:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Lambert X-Patchwork-Id: 9311109 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAF0F60760 for ; Fri, 2 Sep 2016 14:48:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDA44297C4 for ; Fri, 2 Sep 2016 14:48:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2516297C8; Fri, 2 Sep 2016 14:48:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F30E297C4 for ; Fri, 2 Sep 2016 14:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754204AbcIBOr6 (ORCPT ); Fri, 2 Sep 2016 10:47:58 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34135 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754166AbcIBOr4 (ORCPT ); Fri, 2 Sep 2016 10:47:56 -0400 Received: by mail-wm0-f67.google.com with SMTP id v143so3152460wmv.1; Fri, 02 Sep 2016 07:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NrfMIkYk/xxCuw3n73BSf97U46F6KZJCrb4iv65UZzM=; b=xAqd0P1K6ihdg37yBflhno+dkRxx5i6PU5fsl136BgdrJ2KO8YhFhEGhWhs6qlBH6H 4gsAiFJMA60LoqQweV4UTxrnZ7GjUxwciyYcjJcx6WtIZg0bVx7PJe8qYNzseUwDKmqr z3gA43SqCGRTpFjsZzA0hCQwhl58StVoDzkWtphN1F2N+FAVIpL2IvaL9ocBA/Y8iJTK VRNxjzdp7M02TrHvSU/C2KBEBDq/a2HwoGMtcolxg4CxF6t3kOakgwb+2qZThg0JlqL8 OUx5evrqS06cUNZLibHPe41hc1SOfmr6DTpbJG2GH9KIE3Aq0wCAfAI1Wqra6hphXvL2 LBug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NrfMIkYk/xxCuw3n73BSf97U46F6KZJCrb4iv65UZzM=; b=hzbAF6pN1ONf01K1TMDoADHJieyko8LKre1b62shnHK8w8JDtrj6JKbelnE0ZcNSM9 LEzNb46EiWxv8c6u64dEtRV71GEGnqHoXd0GD/glSo6ttExSGFgtI2P3vvNXspzM+4tx XCbY/z3SVp641nzkBlITJL3ZthGSZGwSQnqVp9mmIMPfLus9J9igicS7KZOK4nJgUzS0 ADufp7W+WXzO7Ep5FTLjURMFh6SwYloRlYLcwLWlLnx9/uVxpGFf3hLqV/D+j8cTDqZ7 mNiQlUDeQtC2bbfOq9nxuv5PFMNDevAwq4Ly7PycN4Ea3LSrYKAAMWQiYOMVksPfLFrN HAyQ== X-Gm-Message-State: AE9vXwNit6wTxB7t1P3v6yCBdzFUe9YMEMOgE+3v2QYquRPu+3FJhL41x5fBGvp9ilpJdA== X-Received: by 10.28.126.69 with SMTP id z66mr2122065wmc.74.1472827674738; Fri, 02 Sep 2016 07:47:54 -0700 (PDT) Received: from sloth.lip6.fr (hp-quentin.rsr.lip6.fr. [132.227.76.76]) by smtp.gmail.com with ESMTPSA id bc5sm4188121wjb.37.2016.09.02.07.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Sep 2016 07:47:54 -0700 (PDT) From: Quentin Lambert To: Giovanni Cabiddu , Salvatore Benedetto , Herbert Xu , "David S. Miller" , qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, Quentin Lambert Subject: [PATCH v2 1/2] crypto: qat - introduces a variable to handle error codes Date: Fri, 2 Sep 2016 16:47:52 +0200 Message-Id: <20160902144753.31334-2-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160902144753.31334-1-lambert.quentin@gmail.com> References: <20160902144753.31334-1-lambert.quentin@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most error code used to jump to a label that lead to a "return -EFAULT" statement. This patch introduces a variable that stores the error code so that other error branches can use the same label to exit. Signed-off-by: Quentin Lambert --- drivers/crypto/qat/qat_common/qat_uclo.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/crypto/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/qat/qat_common/qat_uclo.c @@ -966,6 +966,7 @@ static int qat_uclo_parse_uof_obj(struct { struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; unsigned int ae; + int ret; obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t), GFP_KERNEL); @@ -987,29 +988,35 @@ static int qat_uclo_parse_uof_obj(struct !qat_uclo_map_str_table(obj_handle->obj_hdr, ICP_QAT_UOF_STRT, &obj_handle->str_table)) { pr_err("QAT: UOF doesn't have effective images\n"); + ret = -EFAULT; goto out_err; } obj_handle->uimage_num = qat_uclo_map_uimage(obj_handle, obj_handle->ae_uimage, ICP_QAT_UCLO_MAX_AE * ICP_QAT_UCLO_MAX_CTX); - if (!obj_handle->uimage_num) + if (!obj_handle->uimage_num) { + ret = -EFAULT; goto out_err; + } if (qat_uclo_map_ae(handle, handle->hal_handle->ae_max_num)) { pr_err("QAT: Bad object\n"); + ret = -EFAULT; goto out_check_uof_aemask_err; } qat_uclo_init_uword_num(handle); qat_uclo_map_initmem_table(&obj_handle->encap_uof_obj, &obj_handle->init_mem_tab); - if (qat_uclo_set_ae_mode(handle)) + if (qat_uclo_set_ae_mode(handle)) { + ret = -EFAULT; goto out_check_uof_aemask_err; + } return 0; out_check_uof_aemask_err: for (ae = 0; ae < obj_handle->uimage_num; ae++) kfree(obj_handle->ae_uimage[ae].page); out_err: kfree(obj_handle->uword_buf); - return -EFAULT; + return ret; } static int qat_uclo_map_suof_file_hdr(struct icp_qat_fw_loader_handle *handle,