diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3580c0de9d5a8d51209ab4889025d8c599181400..b816469823755ebccc0a629bd3d6c8b186338782 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -684,11 +684,10 @@ void gpiochip_remove(struct gpio_chip *chip) unsigned i; bool requested = false; - /* Numb the device, cancelling all outstanding operations */ - gdev->chip = NULL; - /* FIXME: should the legacy sysfs handling be moved to gpio_device? */ gpiochip_sysfs_unregister(gdev); + /* Numb the device, cancelling all outstanding operations */ + gdev->chip = NULL; gpiochip_irqchip_remove(chip); acpi_gpiochip_remove(chip); gpiochip_remove_pin_ranges(chip);