Unverified Commit ab431a20 authored by Mario Limonciello's avatar Mario Limonciello Committed by Ilpo Järvinen
Browse files

ACPI: platform_profile: Move matching string for new profile out of mutex



Holding the mutex is not necessary while scanning the string passed into
platform_profile_store().

Tested-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: default avatarArmin Wolf <W_Armin@gmx.de>
Reviewed-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-8-mario.limonciello@amd.com


Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 58548400
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@ static ssize_t platform_profile_store(struct device *dev,
{
	int err, i;

	/* Scan for a matching profile */
	i = sysfs_match_string(profile_names, buf);
	if (i < 0)
		return -EINVAL;

	err = mutex_lock_interruptible(&profile_lock);
	if (err)
		return err;
@@ -92,13 +97,6 @@ static ssize_t platform_profile_store(struct device *dev,
		return -ENODEV;
	}

	/* Scan for a matching profile */
	i = sysfs_match_string(profile_names, buf);
	if (i < 0) {
		mutex_unlock(&profile_lock);
		return -EINVAL;
	}

	/* Check that platform supports this profile choice */
	if (!test_bit(i, cur_profile->choices)) {
		mutex_unlock(&profile_lock);