Skip to content

Commit 5541279

Browse files
committed
Merge branch 'pm-cpuidle' into linux-next
* pm-cpuidle: cpuidle: qcom-spm: drop unnecessary initialisations cpuidle: qcom-spm: fix device and OF node leaks at probe
2 parents 141e2b2 + a2d100c commit 5541279

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/cpuidle/cpuidle-qcom-spm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,33 @@ static const struct of_device_id qcom_idle_state_match[] = {
8686

8787
static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
8888
{
89-
struct platform_device *pdev = NULL;
89+
struct platform_device *pdev;
9090
struct device_node *cpu_node, *saw_node;
91-
struct cpuidle_qcom_spm_data *data = NULL;
91+
struct cpuidle_qcom_spm_data *data;
9292
int ret;
9393

9494
cpu_node = of_cpu_device_node_get(cpu);
9595
if (!cpu_node)
9696
return -ENODEV;
9797

9898
saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
99+
of_node_put(cpu_node);
99100
if (!saw_node)
100101
return -ENODEV;
101102

102103
pdev = of_find_device_by_node(saw_node);
103104
of_node_put(saw_node);
104-
of_node_put(cpu_node);
105105
if (!pdev)
106106
return -ENODEV;
107107

108108
data = devm_kzalloc(cpuidle_dev, sizeof(*data), GFP_KERNEL);
109-
if (!data)
109+
if (!data) {
110+
put_device(&pdev->dev);
110111
return -ENOMEM;
112+
}
111113

112114
data->spm = dev_get_drvdata(&pdev->dev);
115+
put_device(&pdev->dev);
113116
if (!data->spm)
114117
return -EINVAL;
115118

0 commit comments

Comments
 (0)