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

Commit ed564a6d authored by Sayali Lokhande's avatar Sayali Lokhande
Browse files

scsi: ufs: Avoid invalid error message in UFS ioctl



This change avoids invalid error message when we query
disk partitions via ioctl by moving NULL buffer check
in function ufshcd_ioctl() inside proper switch case.

Change-Id: Idb3164049d2868953a36f88fce3a982cfd3fe8d6
Signed-off-by: default avatarSayali Lokhande <sayalil@codeaurora.org>
parent be565748
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 * This code is based on drivers/scsi/ufs/ufshcd.c
 * Copyright (C) 2011-2013 Samsung India Software Operations
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * Authors:
 *	Santosh Yaraganavi <santosh.sy@samsung.com>
@@ -7789,13 +7789,14 @@ static int ufshcd_ioctl(struct scsi_device *dev, int cmd, void __user *buffer)
	int err = 0;

	BUG_ON(!hba);
	if (!buffer) {
		dev_err(hba->dev, "%s: User buffer is NULL!\n", __func__);
		return -EINVAL;
	}

	switch (cmd) {
	case UFS_IOCTL_QUERY:
		if (!buffer) {
			dev_err(hba->dev,
				"%s: User buffer is NULL!\n", __func__);
			return -EINVAL;
		}
		pm_runtime_get_sync(hba->dev);
		err = ufshcd_query_ioctl(hba, ufshcd_scsi_to_upiu_lun(dev->lun),
				buffer);