From e0cef40130e18339196bbaa5b948e0ce8f91fdfc Mon Sep 17 00:00:00 2001 From: Yaniv Gardi Date: Tue, 2 Jun 2015 14:33:50 +0300 Subject: [PATCH] scsi: ufs: fix null pointer access in case vops is not set This change fixes a possible access to null pointer variables. Change-Id: I7b57883b71b0e8e8ca437c92cd6fd4f85db91310 Signed-off-by: Yaniv Gardi --- drivers/scsi/ufs/ufshcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index eed086a90118..e43df963a191 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1939,7 +1939,7 @@ int ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) { int ret = 0; - if (hba->vops->crypto_engine_cfg) { + if (hba->vops && hba->vops->crypto_engine_cfg) { ret = hba->vops->crypto_engine_cfg(hba, task_tag); if (ret) { dev_err(hba->dev, @@ -7096,7 +7096,7 @@ static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on) if (info->vdd_hba) { ret = ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on); - if (!ret && hba->vops->update_sec_cfg) + if (!ret && hba->vops && hba->vops->update_sec_cfg) hba->vops->update_sec_cfg(hba, on); } @@ -7248,7 +7248,7 @@ out: hba->clk_gating.state); spin_unlock_irqrestore(hba->host->host_lock, flags); /* restore the secure configuration as clocks are enabled */ - if (hba->vops->update_sec_cfg) + if (hba->vops && hba->vops->update_sec_cfg) hba->vops->update_sec_cfg(hba, true); }