Skip to content

Commit

Permalink
powerpc/83xx: Add missing of_node_put() in mpc832x_spi_init()
Browse files Browse the repository at this point in the history
In mpc832x_spi_init(), hold the reference returned by
of_find_compatible_node() and use it to call of_node_put() for refcount
balance.

Signed-off-by: Liang He <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
windhl authored and mpe committed Sep 5, 2022
1 parent cc0dd82 commit 24156df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/powerpc/platforms/83xx/mpc832x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ static struct spi_board_info mpc832x_spi_boardinfo = {

static int __init mpc832x_spi_init(void)
{
struct device_node *np;

par_io_config_pin(3, 0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
par_io_config_pin(3, 1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
par_io_config_pin(3, 2, 3, 0, 1, 0); /* SPI1 CLK, I/O */
Expand All @@ -175,7 +177,9 @@ static int __init mpc832x_spi_init(void)
* Don't bother with legacy stuff when device tree contains
* mmc-spi-slot node.
*/
if (of_find_compatible_node(NULL, NULL, "mmc-spi-slot"))
np = of_find_compatible_node(NULL, NULL, "mmc-spi-slot");
of_node_put(np);
if (np)
return 0;
return fsl_spi_init(&mpc832x_spi_boardinfo, 1, mpc83xx_spi_cs_control);
}
Expand Down

0 comments on commit 24156df

Please sign in to comment.