diff options
author | Mark Brown <broonie@kernel.org> | 2017-02-19 16:40:55 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-02-19 16:40:55 +0000 |
commit | 42af2f5c52daec0c182af66984927ef64885bbcc (patch) | |
tree | 4ac2ceb6f29d7419ed4b32b3673102ee64895b6c /drivers/spi/spi.c | |
parent | e0afd0facfa921db8d5757709600a136d9cbba6c (diff) | |
parent | 8324147f38019865b29d03baf28412d2ec0bd828 (diff) | |
download | linux-42af2f5c52daec0c182af66984927ef64885bbcc.tar.gz linux-42af2f5c52daec0c182af66984927ef64885bbcc.tar.xz |
Merge remote-tracking branch 'spi/topic/core' into spi-next
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) if (!spi) return; - if (spi->dev.of_node) + if (spi->dev.of_node) { of_node_clear_flag(spi->dev.of_node, OF_POPULATED); + of_node_put(spi->dev.of_node); + } if (ACPI_COMPANION(&spi->dev)) acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev)); device_unregister(&spi->dev); @@ -672,7 +674,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n) if (!n) return -EINVAL; - bi = kzalloc(n * sizeof(*bi), GFP_KERNEL); + bi = kcalloc(n, sizeof(*bi), GFP_KERNEL); if (!bi) return -ENOMEM; @@ -1603,11 +1605,13 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc) if (rc) { dev_err(&master->dev, "spi_device register error %s\n", nc->full_name); - goto err_out; + goto err_of_node_put; } return spi; +err_of_node_put: + of_node_put(nc); err_out: spi_dev_put(spi); return ERR_PTR(rc); |