]> git.baikalelectronics.ru Git - kernel.git/commit
tty: serial: fsl_lpuart: free IDs allocated by IDA
authorMichael Walle <michael@walle.cc>
Tue, 3 Mar 2020 17:42:59 +0000 (18:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2020 13:10:44 +0000 (14:10 +0100)
commit6ebe58facc4ccff4c3ef3db093949ff0183f57d5
treef3bf8423f7de926a03761b20ca3630ac6c1f876d
parent5793a03eb985a6c345f35747f7dce850d58a086e
tty: serial: fsl_lpuart: free IDs allocated by IDA

Since commit f266c62cc6f4 ("serial: fsl_lpuart: Remove the alias node
dependence") the port line number can also be allocated by IDA, but in
case of an error the ID will no be removed again. More importantly, any
ID will be freed in remove(), even if it wasn't allocated but instead
fetched by of_alias_get_id(). If it was not allocated by IDA there will
be a warning:
  WARN(1, "ida_free called for id=%d which is not allocated.\n", id);

Move the ID allocation more to the end of the probe() so that we still
can use plain return in the first error cases.

Fixes: f266c62cc6f4 ("serial: fsl_lpuart: Remove the alias node dependence")
Signed-off-by: Michael Walle <michael@walle.cc>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200303174306.6015-3-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c