Skip to content

Commit cdd0cde

Browse files
tititiou36gregkh
authored andcommitted
USB: typec: tps6598x: Fix a memory leak in an error handling path
All error handling end to the error handling path, except these ones. Go to 'release_fw' as well here, otherwise 'fw' is leaking. Fixes: 7e7a3c8 ("USB: typec: tps6598x: Add TPS25750 support") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a6fe37f commit cdd0cde

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/usb/typec/tipd/core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,16 +968,17 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps)
968968
ret = of_property_match_string(np, "reg-names", "patch-address");
969969
if (ret < 0) {
970970
dev_err(tps->dev, "failed to get patch-address %d\n", ret);
971-
return ret;
971+
goto release_fw;
972972
}
973973

974974
ret = of_property_read_u32_index(np, "reg", ret, &addr);
975975
if (ret)
976-
return ret;
976+
goto release_fw;
977977

978978
if (addr == 0 || (addr >= 0x20 && addr <= 0x23)) {
979979
dev_err(tps->dev, "wrong patch address %u\n", addr);
980-
return -EINVAL;
980+
ret = -EINVAL;
981+
goto release_fw;
981982
}
982983

983984
bpms_data.addr = (u8)addr;

0 commit comments

Comments
 (0)