Skip to content

Commit 0edcd16

Browse files
committed
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()
2 parents d4d1cda + 95cee62 commit 0edcd16

4 files changed

Lines changed: 16 additions & 17 deletions

File tree

‎drivers/remoteproc/remoteproc_core.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,6 @@ static void rproc_resource_cleanup(struct rproc *rproc)
762762
kfree(entry);
763763
}
764764

765-
/* clean up carveout allocations */
766-
list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
767-
dma_free_coherent(dev->parent, entry->len, entry->va, entry->dma);
768-
list_del(&entry->node);
769-
kfree(entry);
770-
}
771-
772765
/* clean up iommu mapping entries */
773766
list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) {
774767
size_t unmapped;
@@ -783,6 +776,13 @@ static void rproc_resource_cleanup(struct rproc *rproc)
783776
list_del(&entry->node);
784777
kfree(entry);
785778
}
779+
780+
/* clean up carveout allocations */
781+
list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
782+
dma_free_coherent(dev->parent, entry->len, entry->va, entry->dma);
783+
list_del(&entry->node);
784+
kfree(entry);
785+
}
786786
}
787787

788788
/*
@@ -815,18 +815,17 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
815815
}
816816

817817
rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
818+
ret = -EINVAL;
818819

819820
/* look for the resource table */
820821
table = rproc_find_rsc_table(rproc, fw, &tablesz);
821822
if (!table) {
822-
ret = -EINVAL;
823823
goto clean_up;
824824
}
825825

826826
/* Verify that resource table in loaded fw is unchanged */
827827
if (rproc->table_csum != crc32(0, table, tablesz)) {
828828
dev_err(dev, "resource checksum failed, fw changed?\n");
829-
ret = -EINVAL;
830829
goto clean_up;
831830
}
832831

@@ -852,8 +851,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
852851
* copy this information to device memory.
853852
*/
854853
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
855-
if (!loaded_table)
854+
if (!loaded_table) {
855+
ret = -EINVAL;
856856
goto clean_up;
857+
}
857858

858859
memcpy(loaded_table, rproc->cached_table, tablesz);
859860

@@ -913,11 +914,10 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
913914
* will be stored in the cached_table. Before the device is started,
914915
* cached_table will be copied into devic memory.
915916
*/
916-
rproc->cached_table = kmalloc(tablesz, GFP_KERNEL);
917+
rproc->cached_table = kmemdup(table, tablesz, GFP_KERNEL);
917918
if (!rproc->cached_table)
918919
goto out;
919920

920-
memcpy(rproc->cached_table, table, tablesz);
921921
rproc->table_ptr = rproc->cached_table;
922922

923923
/* count the number of notify-ids */

‎drivers/remoteproc/remoteproc_debugfs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,5 @@ void __init rproc_init_debugfs(void)
248248

249249
void __exit rproc_exit_debugfs(void)
250250
{
251-
if (rproc_dbg)
252-
debugfs_remove(rproc_dbg);
251+
debugfs_remove(rproc_dbg);
253252
}

‎drivers/remoteproc/remoteproc_internal.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc,
107107

108108
static inline
109109
struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
110-
const struct firmware *fw)
110+
const struct firmware *fw)
111111
{
112112
if (rproc->fw_ops->find_loaded_rsc_table)
113113
return rproc->fw_ops->find_loaded_rsc_table(rproc, fw);
114114

115-
return NULL;
115+
return NULL;
116116
}
117117

118118
extern const struct rproc_fw_ops rproc_elf_fw_ops;

‎include/linux/platform_data/remoteproc-omap.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
5050

5151
#else
5252

53-
void __init omap_rproc_reserve_cma(void)
53+
static inline void __init omap_rproc_reserve_cma(void)
5454
{
5555
}
5656

0 commit comments

Comments
 (0)