lkml.org 
[lkml]   [2021]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 5/9] ufshcd: handle error from blk_ksm_register()
Date
From: Satya Tangirala <satyat@google.com>

Handle any error from blk_ksm_register() in the callers. Previously,
the callers ignored the return value because blk_ksm_register() wouldn't
fail as long as the request_queue didn't have integrity support too, but
as this is no longer the case, it's safer for the callers to just handle
the return value appropriately.

Signed-off-by: Satya Tangirala <satyat@google.com>
---
drivers/scsi/ufs/ufshcd-crypto.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
index d70cdcd35e43..0fcf9d6752f8 100644
--- a/drivers/scsi/ufs/ufshcd-crypto.c
+++ b/drivers/scsi/ufs/ufshcd-crypto.c
@@ -233,6 +233,15 @@ void ufshcd_init_crypto(struct ufs_hba *hba)
void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
struct request_queue *q)
{
- if (hba->caps & UFSHCD_CAP_CRYPTO)
- blk_ksm_register(&hba->ksm, q);
+ if (hba->caps & UFSHCD_CAP_CRYPTO) {
+ /*
+ * This WARN_ON should never trigger since &hba->ksm won't be
+ * "empty" (i.e. will support at least 1 crypto capability), a
+ * UFS device's request queue doesn't support integrity, and
+ * it also satisfies all the block layer constraints (i.e.
+ * supports SG gaps, doesn't have chunk sectors, has a
+ * sufficiently large supported max_segments per bio)
+ */
+ WARN_ON(!blk_ksm_register(&hba->ksm, q));
+ }
}
--
2.25.1
\
 
 \ /
  Last update: 2021-07-07 07:30    [W:0.086 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site