mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
usb: typec: tcpci_rt1711h: unregister TCPCI port with devres
commite8da46d99dupstream. rt1711h_probe() registers the TCPCI port before requesting the interrupt and enabling alert interrupts. If either of those later steps fails, the probe function returns without unregistering the TCPCI port. The explicit unregister currently only happens from the remove callback. Register a devres action immediately after tcpci_register_port() succeeds, so tcpci_unregister_port() runs on later probe failures and on driver detach. Drop the remove callback to avoid unregistering the same port twice. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes:302c570bf3("usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs") Cc: stable <stable@kernel.org> Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Link: https://patch.msgid.link/20260706145312.37260-1-mhun512@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
99d00a9e35
commit
e5406c8fb7
@@ -330,6 +330,8 @@ static int rt1711h_check_revision(struct i2c_client *i2c, struct rt1711h_chip *c
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rt1711h_unregister_tcpci_port(void *tcpci);
|
||||
|
||||
static int rt1711h_probe(struct i2c_client *client)
|
||||
{
|
||||
int ret;
|
||||
@@ -381,6 +383,10 @@ static int rt1711h_probe(struct i2c_client *client)
|
||||
if (IS_ERR_OR_NULL(chip->tcpci))
|
||||
return PTR_ERR(chip->tcpci);
|
||||
|
||||
ret = devm_add_action_or_reset(chip->dev, rt1711h_unregister_tcpci_port, chip->tcpci);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
|
||||
rt1711h_irq,
|
||||
IRQF_ONESHOT | IRQF_TRIGGER_LOW,
|
||||
@@ -398,11 +404,9 @@ static int rt1711h_probe(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt1711h_remove(struct i2c_client *client)
|
||||
static void rt1711h_unregister_tcpci_port(void *tcpci)
|
||||
{
|
||||
struct rt1711h_chip *chip = i2c_get_clientdata(client);
|
||||
|
||||
tcpci_unregister_port(chip->tcpci);
|
||||
tcpci_unregister_port(tcpci);
|
||||
}
|
||||
|
||||
static const struct rt1711h_chip_info rt1711h = {
|
||||
@@ -435,7 +439,6 @@ static struct i2c_driver rt1711h_i2c_driver = {
|
||||
.of_match_table = rt1711h_of_match,
|
||||
},
|
||||
.probe = rt1711h_probe,
|
||||
.remove = rt1711h_remove,
|
||||
.id_table = rt1711h_id,
|
||||
};
|
||||
module_i2c_driver(rt1711h_i2c_driver);
|
||||
|
||||
Reference in New Issue
Block a user