HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()

ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When
hsi_register_port_event() gets some error and returns a negetive value,
the HSI client's port should be released with hsi_release_port().

Fix it by calling hsi_release_port() when hsi_register_port_event() fails.

Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Jianglei Nie 2022-09-05 15:48:01 +08:00 committed by Sebastian Reichel
parent 551e325bbd
commit b28dbcb379
1 changed files with 1 additions and 0 deletions

View File

@ -930,6 +930,7 @@ static int ssip_pn_open(struct net_device *dev)
if (err < 0) {
dev_err(&cl->device, "Register HSI port event failed (%d)\n",
err);
hsi_release_port(cl);
return err;
}
dev_dbg(&cl->device, "Configuring SSI port\n");