Unverified Commit 9176bda5 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15370 wifi: brcmfmac: Check the return value of of_property_read_string_index()

parents 67070b51 52aeec7e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -96,13 +96,13 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
	/* Set board-type to the first string of the machine compatible prop */
	root = of_find_node_by_path("/");
	if (root && err) {
		char *board_type;
		char *board_type = NULL;
		const char *tmp;

		of_property_read_string_index(root, "compatible", 0, &tmp);

		/* get rid of '/' in the compatible string to be able to find the FW */
		if (!of_property_read_string_index(root, "compatible", 0, &tmp))
			board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);

		if (!board_type) {
			of_node_put(root);
			return;