提交 eee23916 编写于 作者: G Gilad Ben-Yossef 提交者: Greg Kroah-Hartman

staging: ccree: simplify expression with local var

Simplify expression by using a local variable for better code
readability.
Signed-off-by: NGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 04294a1c
...@@ -917,6 +917,7 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, ...@@ -917,6 +917,7 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata,
unsigned int authsize = areq_ctx->req_authsize; unsigned int authsize = areq_ctx->req_authsize;
int rc = 0, icv_nents; int rc = 0, icv_nents;
struct device *dev = drvdata_to_dev(drvdata); struct device *dev = drvdata_to_dev(drvdata);
struct scatterlist *sg;
if (req->src == req->dst) { if (req->src == req->dst) {
/*INPLACE*/ /*INPLACE*/
...@@ -955,12 +956,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, ...@@ -955,12 +956,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata,
areq_ctx->mac_buf_dma_addr; areq_ctx->mac_buf_dma_addr;
} }
} else { /* Contig. ICV */ } else { /* Contig. ICV */
sg = &areq_ctx->src_sgl[areq_ctx->src.nents - 1];
/*Should hanlde if the sg is not contig.*/ /*Should hanlde if the sg is not contig.*/
areq_ctx->icv_dma_addr = sg_dma_address( areq_ctx->icv_dma_addr = sg_dma_address(sg) +
&areq_ctx->src_sgl[areq_ctx->src.nents - 1]) +
(*src_last_bytes - authsize); (*src_last_bytes - authsize);
areq_ctx->icv_virt_addr = sg_virt( areq_ctx->icv_virt_addr = sg_virt(sg) +
&areq_ctx->src_sgl[areq_ctx->src.nents - 1]) +
(*src_last_bytes - authsize); (*src_last_bytes - authsize);
} }
...@@ -993,12 +993,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, ...@@ -993,12 +993,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata,
areq_ctx->icv_virt_addr = areq_ctx->backup_mac; areq_ctx->icv_virt_addr = areq_ctx->backup_mac;
} else { /* Contig. ICV */ } else { /* Contig. ICV */
sg = &areq_ctx->src_sgl[areq_ctx->src.nents - 1];
/*Should hanlde if the sg is not contig.*/ /*Should hanlde if the sg is not contig.*/
areq_ctx->icv_dma_addr = sg_dma_address( areq_ctx->icv_dma_addr = sg_dma_address(sg) +
&areq_ctx->src_sgl[areq_ctx->src.nents - 1]) +
(*src_last_bytes - authsize); (*src_last_bytes - authsize);
areq_ctx->icv_virt_addr = sg_virt( areq_ctx->icv_virt_addr = sg_virt(sg) +
&areq_ctx->src_sgl[areq_ctx->src.nents - 1]) +
(*src_last_bytes - authsize); (*src_last_bytes - authsize);
} }
...@@ -1023,12 +1022,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, ...@@ -1023,12 +1022,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata,
} }
if (!areq_ctx->is_icv_fragmented) { if (!areq_ctx->is_icv_fragmented) {
sg = &areq_ctx->dst_sgl[areq_ctx->dst.nents - 1];
/* Contig. ICV */ /* Contig. ICV */
areq_ctx->icv_dma_addr = sg_dma_address( areq_ctx->icv_dma_addr = sg_dma_address(sg) +
&areq_ctx->dst_sgl[areq_ctx->dst.nents - 1]) +
(*dst_last_bytes - authsize); (*dst_last_bytes - authsize);
areq_ctx->icv_virt_addr = sg_virt( areq_ctx->icv_virt_addr = sg_virt(sg) +
&areq_ctx->dst_sgl[areq_ctx->dst.nents - 1]) +
(*dst_last_bytes - authsize); (*dst_last_bytes - authsize);
} else { } else {
areq_ctx->icv_dma_addr = areq_ctx->mac_buf_dma_addr; areq_ctx->icv_dma_addr = areq_ctx->mac_buf_dma_addr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册