mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
Input: Fix memory leak in psxpad_spi_probe
In the implementation of psxpad_spi_probe() the allocated memory for
pdev is leaked if psxpad_spi_init_ff() or input_register_polled_device()
fail. The solution is using device managed allocation, like the one used
for pad. Perform the allocation using
devm_input_allocate_polled_device().
Fixes: 8be193c7b1
("Input: add support for PlayStation 1/2 joypads connected via SPI")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7c193ed6e1
commit
79f0890459
1 changed files with 1 additions and 1 deletions
|
@ -292,7 +292,7 @@ static int psxpad_spi_probe(struct spi_device *spi)
|
|||
if (!pad)
|
||||
return -ENOMEM;
|
||||
|
||||
pdev = input_allocate_polled_device();
|
||||
pdev = devm_input_allocate_polled_device(&spi->dev);
|
||||
if (!pdev) {
|
||||
dev_err(&spi->dev, "failed to allocate input device\n");
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Reference in a new issue