diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7a448233e544..be2eb5c28bfe 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5452,7 +5452,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 }; @@ -5472,7 +5472,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;