Skip to content

Commit ced4913

Browse files
jhovoldmarckleinebudde
authored andcommitted
can: softing_cs: softingcs_probe(): fix memleak on registration failure
In case device registration fails during probe, the driver state and the embedded platform device structure needs to be freed using platform_device_put() to properly free all resources (e.g. the device name). Fixes: 0a0b7a5 ("can: add driver for Softing card") Link: https://lore.kernel.org/all/20211222104843.6105-1-johan@kernel.org Cc: stable@vger.kernel.org # 2.6.38 Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 6dc9a23 commit ced4913

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/can/softing/softing_cs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia)
293293
return 0;
294294

295295
platform_failed:
296-
kfree(dev);
296+
platform_device_put(pdev);
297297
mem_failed:
298298
pcmcia_bad:
299299
pcmcia_failed:

0 commit comments

Comments
 (0)