soc: loongson: loongson2_guts: Add check for devm_kstrdup()
Add check for the return value of devm_kstrdup() in
loongson2_guts_probe() to catch potential exception.
Fixes: b82621ac84
("soc: loongson: add GUTS driver for loongson-2 platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Link: https://lore.kernel.org/r/20250220081714.2676828-1-haoxiang_li2024@163.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
e1fc41045c
commit
e31e3f6c0c
1 changed files with 4 additions and 1 deletions
|
@ -114,8 +114,11 @@ static int loongson2_guts_probe(struct platform_device *pdev)
|
|||
if (of_property_read_string(root, "model", &machine))
|
||||
of_property_read_string_index(root, "compatible", 0, &machine);
|
||||
of_node_put(root);
|
||||
if (machine)
|
||||
if (machine) {
|
||||
soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
|
||||
if (!soc_dev_attr.machine)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
svr = loongson2_guts_get_svr();
|
||||
soc_die = loongson2_soc_die_match(svr, loongson2_soc_die);
|
||||
|
|
Loading…
Add table
Reference in a new issue