Skip to content

Commit 5bca368

Browse files
Yuuoniydtor
authored andcommitted
Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe
rpi_firmware_get() take reference, we need to release it in error paths as well. Use devm_rpi_firmware_get() helper to handling the resources. Also remove the existing rpi_firmware_put(). Fixes: 0b9f28f ("Input: add official Raspberry Pi's touchscreen driver") Fixes: 3b8ddff ("input: raspberrypi-ts: Release firmware handle when not needed") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20221223074657.810346-1-linmq006@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 483a144 commit 5bca368

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/input/touchscreen/raspberrypi-ts.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int rpi_ts_probe(struct platform_device *pdev)
134134
return -ENOENT;
135135
}
136136

137-
fw = rpi_firmware_get(fw_node);
137+
fw = devm_rpi_firmware_get(&pdev->dev, fw_node);
138138
of_node_put(fw_node);
139139
if (!fw)
140140
return -EPROBE_DEFER;
@@ -160,7 +160,6 @@ static int rpi_ts_probe(struct platform_device *pdev)
160160
touchbuf = (u32)ts->fw_regs_phys;
161161
error = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF,
162162
&touchbuf, sizeof(touchbuf));
163-
rpi_firmware_put(fw);
164163
if (error || touchbuf != 0) {
165164
dev_warn(dev, "Failed to set touchbuf, %d\n", error);
166165
return error;

0 commit comments

Comments
 (0)