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

Commit d553a0ff authored by Nitin Rawat's avatar Nitin Rawat
Browse files

scsi: ufs: Check qcg before dereferencing



Check qcg before dereferencing to avoid NULL pointer
dereference and return if its NULL. This is is to
fix below kw warnings.

ufs-qcom.c:2489: 'qcg' is assigned the return value from
function 'cpu_to_group'.
ufs-qcom.c:2439: 'cpu_to_group' explicitly returns
a NULL value.
ufs-qcom.c:2490: 'qcg' is explicitly dereferenced.

Change-Id: I291c9230bb7fb5df414db8f80bfb17a50c8fc7cf
Signed-off-by: default avatarNitin Rawat <nitirawa@codeaurora.org>
parent e0f5b510
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2487,6 +2487,9 @@ static void ufs_qcom_qos(struct ufs_hba *hba, int tag, bool is_scsi_cmd)
	if (cpu < 0)
		return;
	qcg = cpu_to_group(host->ufs_qos, cpu);
	if (!qcg)
		return;

	if (qcg->voted) {
		dev_dbg(qcg->host->hba->dev, "%s: qcg: 0x%08x | Mask: 0x%08x - Already voted - return\n",
			__func__, qcg, qcg->mask);