Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: musb: fix PM reference leak in musb_irq_work()

pm_runtime_get_sync will increment pm usage counter even it failed.
thus a pairing decrement is needed.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Link: https://lore.kernel.org/r/20210408091836.55227-1-cuibixuan@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bixuan Cui and committed by
Greg Kroah-Hartman
9535b995 a932ee40

+1 -1
+1 -1
drivers/usb/musb/musb_core.c
··· 2070 2070 struct musb *musb = container_of(data, struct musb, irq_work.work); 2071 2071 int error; 2072 2072 2073 - error = pm_runtime_get_sync(musb->controller); 2073 + error = pm_runtime_resume_and_get(musb->controller); 2074 2074 if (error < 0) { 2075 2075 dev_err(musb->controller, "Could not enable: %i\n", error); 2076 2076