1

Staging driver fixes for 6.12-rc7

Here are 2 small memory leak fixes for the vchiq_arm staging driver that
 have been sitting in my tree for weeks and should get merged for
 6.12-rc7 so that people don't keep tripping over them.
 
 They both have been in linux-next for a while with no reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZzBTIA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yllHwCeMvMzbvC5oQlP+smYqztKQ1sFZggAniTlHzx5
 9tz+/T2kibuy7V2A1kqw
 =MASn
 -----END PGP SIGNATURE-----

Merge tag 'staging-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are two small memory leak fixes for the vchiq_arm staging driver
  that have been sitting in my tree for weeks and should get merged for
  6.12-rc7 so that people don't keep tripping over them.

  They both have been in linux-next for a while with no reported
  problems"

* tag 'staging-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: vchiq_arm: Use devm_kzalloc() for drv_mgmt allocation
  staging: vchiq_arm: Use devm_kzalloc() for vchiq_arm_state allocation
This commit is contained in:
Linus Torvalds 2024-11-10 08:53:24 -08:00
commit 023d4fc00f

View File

@ -593,7 +593,7 @@ vchiq_platform_init_state(struct vchiq_state *state)
{ {
struct vchiq_arm_state *platform_state; struct vchiq_arm_state *platform_state;
platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL); platform_state = devm_kzalloc(state->dev, sizeof(*platform_state), GFP_KERNEL);
if (!platform_state) if (!platform_state)
return -ENOMEM; return -ENOMEM;
@ -1731,7 +1731,7 @@ static int vchiq_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
mgmt = kzalloc(sizeof(*mgmt), GFP_KERNEL); mgmt = devm_kzalloc(&pdev->dev, sizeof(*mgmt), GFP_KERNEL);
if (!mgmt) if (!mgmt)
return -ENOMEM; return -ENOMEM;
@ -1789,8 +1789,6 @@ static void vchiq_remove(struct platform_device *pdev)
arm_state = vchiq_platform_get_arm_state(&mgmt->state); arm_state = vchiq_platform_get_arm_state(&mgmt->state);
kthread_stop(arm_state->ka_thread); kthread_stop(arm_state->ka_thread);
kfree(mgmt);
} }
static struct platform_driver vchiq_driver = { static struct platform_driver vchiq_driver = {