diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2012-02-29 15:40:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:23:17 -0500 |
commit | 62ebeed8d00aef75eac4fd6c161cae75a41965ca (patch) | |
tree | c4d51c92bca401bb5e1b0f8c230d7fceb00f91ac /drivers/net/wireless/p54/p54spi.c | |
parent | 461bc26c93f27d306a0e74cf642b33eb9d2d4112 (diff) |
p54spi: Release GPIO lines and IRQ on error in p54spi_probe
This makes it possible to reload driver if insmod has failed due to
missing firmware.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54spi.c')
-rw-r--r-- | drivers/net/wireless/p54/p54spi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index 7faed62c6378..f7929906d437 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -618,19 +618,19 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
618 | ret = spi_setup(spi); | 618 | ret = spi_setup(spi); |
619 | if (ret < 0) { | 619 | if (ret < 0) { |
620 | dev_err(&priv->spi->dev, "spi_setup failed"); | 620 | dev_err(&priv->spi->dev, "spi_setup failed"); |
621 | goto err_free_common; | 621 | goto err_free; |
622 | } | 622 | } |
623 | 623 | ||
624 | ret = gpio_request(p54spi_gpio_power, "p54spi power"); | 624 | ret = gpio_request(p54spi_gpio_power, "p54spi power"); |
625 | if (ret < 0) { | 625 | if (ret < 0) { |
626 | dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); | 626 | dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); |
627 | goto err_free_common; | 627 | goto err_free; |
628 | } | 628 | } |
629 | 629 | ||
630 | ret = gpio_request(p54spi_gpio_irq, "p54spi irq"); | 630 | ret = gpio_request(p54spi_gpio_irq, "p54spi irq"); |
631 | if (ret < 0) { | 631 | if (ret < 0) { |
632 | dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); | 632 | dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); |
633 | goto err_free_common; | 633 | goto err_free_gpio_power; |
634 | } | 634 | } |
635 | 635 | ||
636 | gpio_direction_output(p54spi_gpio_power, 0); | 636 | gpio_direction_output(p54spi_gpio_power, 0); |
@@ -641,7 +641,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
641 | priv->spi); | 641 | priv->spi); |
642 | if (ret < 0) { | 642 | if (ret < 0) { |
643 | dev_err(&priv->spi->dev, "request_irq() failed"); | 643 | dev_err(&priv->spi->dev, "request_irq() failed"); |
644 | goto err_free_common; | 644 | goto err_free_gpio_irq; |
645 | } | 645 | } |
646 | 646 | ||
647 | irq_set_irq_type(gpio_to_irq(p54spi_gpio_irq), IRQ_TYPE_EDGE_RISING); | 647 | irq_set_irq_type(gpio_to_irq(p54spi_gpio_irq), IRQ_TYPE_EDGE_RISING); |
@@ -673,6 +673,12 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
673 | return 0; | 673 | return 0; |
674 | 674 | ||
675 | err_free_common: | 675 | err_free_common: |
676 | free_irq(gpio_to_irq(p54spi_gpio_irq), spi); | ||
677 | err_free_gpio_irq: | ||
678 | gpio_free(p54spi_gpio_irq); | ||
679 | err_free_gpio_power: | ||
680 | gpio_free(p54spi_gpio_power); | ||
681 | err_free: | ||
676 | p54_free_common(priv->hw); | 682 | p54_free_common(priv->hw); |
677 | return ret; | 683 | return ret; |
678 | } | 684 | } |