Unverified Commit 8560b277 authored by Suma Hegde's avatar Suma Hegde Committed by Ilpo Järvinen
Browse files

platform/x86/amd/hsmp: Change the error type



When file is opened in WRITE only mode, then GET messages are not allowed
and when file is opened in READ only mode, SET messages are not allowed.
In these scenerios, return error EPERM to userspace instead of EINVAL.

Signed-off-by: default avatarSuma Hegde <suma.hegde@amd.com>
Reviewed-by: default avatarNaveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20241112120450.2407125-2-suma.hegde@amd.com


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 996b318e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
		 * Execute only set/configure commands
		 */
		if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_SET)
			return -EINVAL;
			return -EPERM;
		break;
	case FMODE_READ:
		/*
@@ -270,7 +270,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
		 * Execute only get/monitor commands
		 */
		if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_GET)
			return -EINVAL;
			return -EPERM;
		break;
	case FMODE_READ | FMODE_WRITE:
		/*
@@ -279,7 +279,7 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
		 */
		break;
	default:
		return -EINVAL;
		return -EPERM;
	}

	ret = hsmp_send_message(&msg);