@@ -238,18 +238,11 @@ EXPORT_SYMBOL(cmd_db_read_slave_id);
static int cmd_db_dev_probe(struct platform_device *pdev)
{
- struct reserved_mem *rmem;
int ret = 0;
- rmem = of_reserved_mem_lookup(pdev->dev.of_node);
- if (!rmem) {
- dev_err(&pdev->dev, "failed to acquire memory region\n");
- return -EINVAL;
- }
-
- cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB);
- if (!cmd_db_header) {
- ret = -ENOMEM;
+ cmd_db_header = devm_memremap_reserved_mem(&pdev->dev, MEMREMAP_WB);
+ if (IS_ERR(cmd_db_header)) {
+ ret = PTR_ERR(cmd_db_header);
cmd_db_header = NULL;
return ret;
}