diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-11-21 14:01:11 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-13 08:42:44 +0100 |
commit | 9eb2551315d8bd9f326ecfac202dfa97d4543bf2 (patch) | |
tree | af7219e226be037e0b793570ca7545882f08faac /drivers/input/joystick | |
parent | a295943689d4a1d857593a9194a1ebb5a88d4d27 (diff) |
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: 8be193c7b1f4 ("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>
Diffstat (limited to 'drivers/input/joystick')
-rw-r--r-- | drivers/input/joystick/psxpad-spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c index 7eee1b0e360f..99a6052500ca 100644 --- a/drivers/input/joystick/psxpad-spi.c +++ b/drivers/input/joystick/psxpad-spi.c @@ -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; |