Message ID | 20230920091226.55663-1-zhanghui31@xiaomi.com |
---|---|
State | New |
Headers | show |
Series | scsi: ufs: core: Do not access null point in ufshpb_remove | expand |
diff --git a/drivers/ufs/core/ufshpb.c b/drivers/ufs/core/ufshpb.c index 255f8b38d0c2..fa345e161cb8 100644 --- a/drivers/ufs/core/ufshpb.c +++ b/drivers/ufs/core/ufshpb.c @@ -2656,6 +2656,9 @@ void ufshpb_init(struct ufs_hba *hba) void ufshpb_remove(struct ufs_hba *hba) { + if (!ufshpb_is_allowed(hba) || !hba->dev_info.hpb_enabled) + return; + mempool_destroy(ufshpb_page_pool); mempool_destroy(ufshpb_mctx_pool); kmem_cache_destroy(ufshpb_mctx_cache);