scsi: ufs: Initialize offset to a default value.
This patch initializes offset to a default value.
This is done to silence 'offset might be used uninitialized
in this function' warning.
Change-Id: Ia36b1a7eda04afd5a52ae2a5d92535c529aa244b
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 46c8268..39ab28a 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -2499,7 +2499,7 @@
int ufs_qcom_testbus_config(struct ufs_qcom_host *host)
{
int reg = 0;
- int offset, ret = 0, testbus_sel_offset = 19;
+ int offset = -1, ret = 0, testbus_sel_offset = 19;
u32 mask = TEST_BUS_SUB_SEL_MASK;
unsigned long flags;
struct ufs_hba *hba;
@@ -2564,6 +2564,12 @@
* is legal
*/
}
+ if (offset < 0) {
+ dev_err(hba->dev, "%s: Bad offset: %d\n", __func__, offset);
+ ret = -EINVAL;
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
+ goto out;
+ }
mask <<= offset;
spin_unlock_irqrestore(hba->host->host_lock, flags);