Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f275e14b authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs: fix two minor potential errors



Two variables 'err' and 'offset' might be used uninitialized. Fix this by
giving them proper initial values and checking sanity of 'offset' before
use it.

Change-Id: I3dc842656b6da9932edc09da111dd2fb78d957f6
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 01e90b62
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1552,7 +1552,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
				 enum ufs_notify_change_status status)
{
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int err;
	int err = 0;

	/*
	 * In case ufs_qcom_init() is not yet done, simply ignore.
@@ -2547,7 +2547,7 @@ bool ufs_qcom_testbus_cfg_is_ok(struct ufs_qcom_host *host,
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;
@@ -2612,6 +2612,13 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host)
	 * 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);