summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMallikarjun Kasoju <mkasoju@nvidia.com>2012-05-09 18:24:17 +0530
committerSimone Willett <swillett@nvidia.com>2012-06-04 13:39:06 -0700
commit2d355c2e2b66359ed3a7f044185df5cfaf305c82 (patch)
treed28814baa1d5e13d78ee182ddc66c7c73fb69bd6 /drivers
parent892a06364ceb8739e6f3d97ff955c17374afb0dc (diff)
crypto: tegra-se: Use sg_next to get next sg
Use sg_next to get next sg Bug 958431 Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Change-Id: I14aa7c9c551d0230b9c5b681a2699dd5355d0a6d Reviewed-on: http://git-master/r/98449 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Tested-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/tegra-se.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/crypto/tegra-se.c b/drivers/crypto/tegra-se.c
index 3d2e9187b949..83324162a09f 100644
--- a/drivers/crypto/tegra-se.c
+++ b/drivers/crypto/tegra-se.c
@@ -622,9 +622,12 @@ static int tegra_se_count_sgs(struct scatterlist *sl, u32 total_bytes)
return 0;
do {
- total_bytes -= min(sl[i].length, total_bytes);
+ if (!sl->length)
+ return 0;
+ total_bytes -= min(sl->length, total_bytes);
i++;
- } while (total_bytes);
+ sl = sg_next(sl);
+ } while (total_bytes && sl);
return i;
}
@@ -846,7 +849,7 @@ static int tegra_se_aes_queue_req(struct ablkcipher_request *req)
bool idle = true;
int err = 0;
- if (!req->nbytes)
+ if (!tegra_se_count_sgs(req->src, req->nbytes))
return -EINVAL;
spin_lock_irqsave(&se_dev->lock, flags);