Commit 0edcd16a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'remoteproc-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc

Pull remoteproc fixes from Ohad Ben-Cohen:
 "Trivial remoteproc fixes by Suman Anna, Wei Yongjun and Thomas Meyer"

* tag 'remoteproc-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  remoteproc: Cocci spatch "memdup.spatch"
  remoteproc: free carveout memories only after unmapping them
  remoteproc/omap: fix a sparse warning
  remoteproc: fix checkpatch errors in remoteproc code
  remoteproc: fix error return code in rproc_fw_boot()
parents d4d1cda6 95cee62c
...@@ -762,13 +762,6 @@ static void rproc_resource_cleanup(struct rproc *rproc) ...@@ -762,13 +762,6 @@ static void rproc_resource_cleanup(struct rproc *rproc)
kfree(entry); kfree(entry);
} }
/* clean up carveout allocations */
list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
dma_free_coherent(dev->parent, entry->len, entry->va, entry->dma);
list_del(&entry->node);
kfree(entry);
}
/* clean up iommu mapping entries */ /* clean up iommu mapping entries */
list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) { list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) {
size_t unmapped; size_t unmapped;
...@@ -783,6 +776,13 @@ static void rproc_resource_cleanup(struct rproc *rproc) ...@@ -783,6 +776,13 @@ static void rproc_resource_cleanup(struct rproc *rproc)
list_del(&entry->node); list_del(&entry->node);
kfree(entry); kfree(entry);
} }
/* clean up carveout allocations */
list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
dma_free_coherent(dev->parent, entry->len, entry->va, entry->dma);
list_del(&entry->node);
kfree(entry);
}
} }
/* /*
...@@ -815,18 +815,17 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) ...@@ -815,18 +815,17 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
} }
rproc->bootaddr = rproc_get_boot_addr(rproc, fw); rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
ret = -EINVAL;
/* look for the resource table */ /* look for the resource table */
table = rproc_find_rsc_table(rproc, fw, &tablesz); table = rproc_find_rsc_table(rproc, fw, &tablesz);
if (!table) { if (!table) {
ret = -EINVAL;
goto clean_up; goto clean_up;
} }
/* Verify that resource table in loaded fw is unchanged */ /* Verify that resource table in loaded fw is unchanged */
if (rproc->table_csum != crc32(0, table, tablesz)) { if (rproc->table_csum != crc32(0, table, tablesz)) {
dev_err(dev, "resource checksum failed, fw changed?\n"); dev_err(dev, "resource checksum failed, fw changed?\n");
ret = -EINVAL;
goto clean_up; goto clean_up;
} }
...@@ -852,8 +851,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) ...@@ -852,8 +851,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
* copy this information to device memory. * copy this information to device memory.
*/ */
loaded_table = rproc_find_loaded_rsc_table(rproc, fw); loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
if (!loaded_table) if (!loaded_table) {
ret = -EINVAL;
goto clean_up; goto clean_up;
}
memcpy(loaded_table, rproc->cached_table, tablesz); memcpy(loaded_table, rproc->cached_table, tablesz);
...@@ -913,11 +914,10 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) ...@@ -913,11 +914,10 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
* will be stored in the cached_table. Before the device is started, * will be stored in the cached_table. Before the device is started,
* cached_table will be copied into devic memory. * cached_table will be copied into devic memory.
*/ */
rproc->cached_table = kmalloc(tablesz, GFP_KERNEL); rproc->cached_table = kmemdup(table, tablesz, GFP_KERNEL);
if (!rproc->cached_table) if (!rproc->cached_table)
goto out; goto out;
memcpy(rproc->cached_table, table, tablesz);
rproc->table_ptr = rproc->cached_table; rproc->table_ptr = rproc->cached_table;
/* count the number of notify-ids */ /* count the number of notify-ids */
......
...@@ -248,6 +248,5 @@ void __init rproc_init_debugfs(void) ...@@ -248,6 +248,5 @@ void __init rproc_init_debugfs(void)
void __exit rproc_exit_debugfs(void) void __exit rproc_exit_debugfs(void)
{ {
if (rproc_dbg) debugfs_remove(rproc_dbg);
debugfs_remove(rproc_dbg);
} }
...@@ -107,12 +107,12 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc, ...@@ -107,12 +107,12 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc,
static inline static inline
struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc, struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
const struct firmware *fw) const struct firmware *fw)
{ {
if (rproc->fw_ops->find_loaded_rsc_table) if (rproc->fw_ops->find_loaded_rsc_table)
return rproc->fw_ops->find_loaded_rsc_table(rproc, fw); return rproc->fw_ops->find_loaded_rsc_table(rproc, fw);
return NULL; return NULL;
} }
extern const struct rproc_fw_ops rproc_elf_fw_ops; extern const struct rproc_fw_ops rproc_elf_fw_ops;
......
...@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void); ...@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
#else #else
void __init omap_rproc_reserve_cma(void) static inline void __init omap_rproc_reserve_cma(void)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment