diff options
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 656dd3e3220c..59cb26470d70 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -621,8 +621,10 @@ void spi_unregister_device(struct spi_device *spi) | |||
621 | if (!spi) | 621 | if (!spi) |
622 | return; | 622 | return; |
623 | 623 | ||
624 | if (spi->dev.of_node) | 624 | if (spi->dev.of_node) { |
625 | of_node_clear_flag(spi->dev.of_node, OF_POPULATED); | 625 | of_node_clear_flag(spi->dev.of_node, OF_POPULATED); |
626 | of_node_put(spi->dev.of_node); | ||
627 | } | ||
626 | if (ACPI_COMPANION(&spi->dev)) | 628 | if (ACPI_COMPANION(&spi->dev)) |
627 | acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev)); | 629 | acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev)); |
628 | device_unregister(&spi->dev); | 630 | device_unregister(&spi->dev); |
@@ -672,7 +674,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n) | |||
672 | if (!n) | 674 | if (!n) |
673 | return -EINVAL; | 675 | return -EINVAL; |
674 | 676 | ||
675 | bi = kzalloc(n * sizeof(*bi), GFP_KERNEL); | 677 | bi = kcalloc(n, sizeof(*bi), GFP_KERNEL); |
676 | if (!bi) | 678 | if (!bi) |
677 | return -ENOMEM; | 679 | return -ENOMEM; |
678 | 680 | ||
@@ -1603,11 +1605,13 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc) | |||
1603 | if (rc) { | 1605 | if (rc) { |
1604 | dev_err(&master->dev, "spi_device register error %s\n", | 1606 | dev_err(&master->dev, "spi_device register error %s\n", |
1605 | nc->full_name); | 1607 | nc->full_name); |
1606 | goto err_out; | 1608 | goto err_of_node_put; |
1607 | } | 1609 | } |
1608 | 1610 | ||
1609 | return spi; | 1611 | return spi; |
1610 | 1612 | ||
1613 | err_of_node_put: | ||
1614 | of_node_put(nc); | ||
1611 | err_out: | 1615 | err_out: |
1612 | spi_dev_put(spi); | 1616 | spi_dev_put(spi); |
1613 | return ERR_PTR(rc); | 1617 | return ERR_PTR(rc); |