diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7d85c04fbba2a..0e6562ff3dcf8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5244,7 +5244,7 @@ static ssize_t reset_method_store(struct device *dev, const char *buf, size_t count) { struct pci_dev *pdev = to_pci_dev(dev); - char *options, *name; + char *options, *tmp_options, *name; int m, n; u8 reset_methods[PCI_NUM_RESET_METHODS] = { 0 }; @@ -5264,7 +5264,8 @@ static ssize_t reset_method_store(struct device *dev, return -ENOMEM; n = 0; - while ((name = strsep(&options, " ")) != NULL) { + tmp_options = options; + while ((name = strsep(&tmp_options, " ")) != NULL) { if (sysfs_streq(name, "")) continue;