History

of: restricted dma: Fix condition for rmem init

of_dma_set_restricted_buffer fails to handle negative return values from of_property_count_elems_of_size, e.g. when the property does not exist. This results in an attempt to assign a non-existent reserved memory region to the device and a warning being printed. Fix the condition to take negative values into account.

David Brazdil committed 5 years ago

Commit 31c80251 parent c8087ad1 file · +5 −1Browse files

Unified · Split

drivers/of/device.c+5−1
@@ -85,7 +85,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct device_node *np) · 84 unmodified lines
85 break;85 break;
86 }86 }
87 87
88 if (i != count && of_reserved_mem_device_init_by_idx(dev, of_node, i))88 /*
89 * Attempt to initialize a restricted-dma-pool region if one was found.
90 * Note that count can hold a negative error code.
91 */
92 if (i < count && of_reserved_mem_device_init_by_idx(dev, of_node, i))
89 dev_warn(dev, "failed to initialise \"restricted-dma-pool\" memory node\n");93 dev_warn(dev, "failed to initialise \"restricted-dma-pool\" memory node\n");
90}94}
91 95

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t