mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
clk: hisilicon: reset: Use devm_kzalloc to initialize hisi_reset_controller
Using devm_kmalloc() does not zero-initialize the allocated structure.
Uninitialized members in struct hisi_reset_controller may contain garbage
data, which can cause reset_controller_register() to fail unexpectedly.
Replace devm_kmalloc() with devm_kzalloc() to ensure all structure fields
are properly zero-initialized.
Fixes: 97b7129cd2 ("reset: hisilicon: change the definition of hisi_reset_init")
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Min zhang <zhangmin2026@yeah.net>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
parent
003d9ba31a
commit
a8036f4591
|
|
@ -91,7 +91,7 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)
|
|||
{
|
||||
struct hisi_reset_controller *rstc;
|
||||
|
||||
rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
|
||||
rstc = devm_kzalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
|
||||
if (!rstc)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user