Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a824d306 authored by Dipen Parmar's avatar Dipen Parmar
Browse files

thermal: tsens: Add NULL pointer check for id



Add NULL pointer check for id value to avoid the
NULL pointer dereference when of_match_node function
can return NULL for non-matching node.

Change-Id: If01290f11c44631249b0740271b2d51a3654b54a
Signed-off-by: default avatarDipen Parmar <dipenp@codeaurora.org>
parent 9c445fa6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2281,8 +2281,13 @@ static int get_device_tree_data(struct platform_device *pdev)
	if (!of_match_node(tsens_match, of_node)) {
		pr_err("Need to read SoC specific fuse map\n");
		return -ENODEV;
	} else
	} else {
		id = of_match_node(tsens_match, of_node);
		if (id == NULL) {
			pr_err("can not find tsens_match of_node\n");
			return -ENODEV;
		}
	}

	tmdev = devm_kzalloc(&pdev->dev,
			sizeof(struct tsens_tm_device) +