diff mbox series

[v1] PCI/ASPM: Convert to use sysfs_match_string() helper

Message ID 20180803095137.52401-1-andriy.shevchenko@linux.intel.com
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series [v1] PCI/ASPM: Convert to use sysfs_match_string() helper | expand

Commit Message

Andy Shevchenko Aug. 3, 2018, 9:51 a.m. UTC
The commit

  4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")

didn't take into consideration small but crucial detail about scope of
usage, i.e. sysfs interface provided to handle the ASPM policy. Due to
this in most of the cases input string comes with a new line symbol.

Use sysfs_match_string() helper to take into account above.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Fixes: 4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")
---
 drivers/pci/pcie/aspm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Helgaas Aug. 6, 2018, 7:34 p.m. UTC | #1
On Fri, Aug 03, 2018 at 12:51:37PM +0300, Andy Shevchenko wrote:
> The commit
> 
>   4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")
> 
> didn't take into consideration small but crucial detail about scope of
> usage, i.e. sysfs interface provided to handle the ASPM policy. Due to
> this in most of the cases input string comes with a new line symbol.
> 
> Use sysfs_match_string() helper to take into account above.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
> Fixes: 4cec16861a40 ("PCI/ASPM: Convert to use match_string() helper")

Folded into original patch on pci/aspm for v4.19, thanks!

> ---
>  drivers/pci/pcie/aspm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 0e88b3ad065f..5326916715d2 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1127,7 +1127,7 @@ static int pcie_aspm_set_policy(const char *val,
>  
>  	if (aspm_disabled)
>  		return -EPERM;
> -	i = match_string(policy_str, ARRAY_SIZE(policy_str), val);
> +	i = sysfs_match_string(policy_str, val);
>  	if (i < 0)
>  		return i;
>  	if (i == aspm_policy)
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 0e88b3ad065f..5326916715d2 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1127,7 +1127,7 @@  static int pcie_aspm_set_policy(const char *val,
 
 	if (aspm_disabled)
 		return -EPERM;
-	i = match_string(policy_str, ARRAY_SIZE(policy_str), val);
+	i = sysfs_match_string(policy_str, val);
 	if (i < 0)
 		return i;
 	if (i == aspm_policy)