diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-11 15:35:09 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-11 15:35:09 -0400 |
| commit | 0edcd16a4def296bd6492ae0c10a3c4aef9ef7c0 (patch) | |
| tree | 9d46123ddc7e42ce573bc05701fdfa5cd15b497e | |
| parent | d4d1cda6ef48a99dee5c0f3334a556845e84dd92 (diff) | |
| parent | 95cee62cb4776a65229a6b6d5969be56589d95c1 (diff) | |
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()
| -rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 24 | ||||
| -rw-r--r-- | drivers/remoteproc/remoteproc_debugfs.c | 3 | ||||
| -rw-r--r-- | drivers/remoteproc/remoteproc_internal.h | 4 | ||||
| -rw-r--r-- | include/linux/platform_data/remoteproc-omap.h | 2 |
4 files changed, 16 insertions, 17 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 022dc635d01e..3cd85a638afa 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
| @@ -762,13 +762,6 @@ static void rproc_resource_cleanup(struct rproc *rproc) | |||
| 762 | kfree(entry); | 762 | kfree(entry); |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 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 | |||
| 772 | /* clean up iommu mapping entries */ | 765 | /* clean up iommu mapping entries */ |
| 773 | list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) { | 766 | list_for_each_entry_safe(entry, tmp, &rproc->mappings, node) { |
| 774 | size_t unmapped; | 767 | size_t unmapped; |
| @@ -783,6 +776,13 @@ static void rproc_resource_cleanup(struct rproc *rproc) | |||
| 783 | list_del(&entry->node); | 776 | list_del(&entry->node); |
| 784 | kfree(entry); | 777 | kfree(entry); |
| 785 | } | 778 | } |
| 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 | } | ||
| 786 | } | 786 | } |
| 787 | 787 | ||
| 788 | /* | 788 | /* |
| @@ -815,18 +815,17 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
| 815 | } | 815 | } |
| 816 | 816 | ||
| 817 | rproc->bootaddr = rproc_get_boot_addr(rproc, fw); | 817 | rproc->bootaddr = rproc_get_boot_addr(rproc, fw); |
| 818 | ret = -EINVAL; | ||
| 818 | 819 | ||
| 819 | /* look for the resource table */ | 820 | /* look for the resource table */ |
| 820 | table = rproc_find_rsc_table(rproc, fw, &tablesz); | 821 | table = rproc_find_rsc_table(rproc, fw, &tablesz); |
| 821 | if (!table) { | 822 | if (!table) { |
| 822 | ret = -EINVAL; | ||
| 823 | goto clean_up; | 823 | goto clean_up; |
| 824 | } | 824 | } |
| 825 | 825 | ||
| 826 | /* Verify that resource table in loaded fw is unchanged */ | 826 | /* Verify that resource table in loaded fw is unchanged */ |
| 827 | if (rproc->table_csum != crc32(0, table, tablesz)) { | 827 | if (rproc->table_csum != crc32(0, table, tablesz)) { |
| 828 | dev_err(dev, "resource checksum failed, fw changed?\n"); | 828 | dev_err(dev, "resource checksum failed, fw changed?\n"); |
| 829 | ret = -EINVAL; | ||
| 830 | goto clean_up; | 829 | goto clean_up; |
| 831 | } | 830 | } |
| 832 | 831 | ||
| @@ -852,8 +851,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
| 852 | * copy this information to device memory. | 851 | * copy this information to device memory. |
| 853 | */ | 852 | */ |
| 854 | loaded_table = rproc_find_loaded_rsc_table(rproc, fw); | 853 | loaded_table = rproc_find_loaded_rsc_table(rproc, fw); |
| 855 | if (!loaded_table) | 854 | if (!loaded_table) { |
| 855 | ret = -EINVAL; | ||
| 856 | goto clean_up; | 856 | goto clean_up; |
| 857 | } | ||
| 857 | 858 | ||
| 858 | memcpy(loaded_table, rproc->cached_table, tablesz); | 859 | memcpy(loaded_table, rproc->cached_table, tablesz); |
| 859 | 860 | ||
| @@ -913,11 +914,10 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) | |||
| 913 | * will be stored in the cached_table. Before the device is started, | 914 | * will be stored in the cached_table. Before the device is started, |
| 914 | * cached_table will be copied into devic memory. | 915 | * cached_table will be copied into devic memory. |
| 915 | */ | 916 | */ |
| 916 | rproc->cached_table = kmalloc(tablesz, GFP_KERNEL); | 917 | rproc->cached_table = kmemdup(table, tablesz, GFP_KERNEL); |
| 917 | if (!rproc->cached_table) | 918 | if (!rproc->cached_table) |
| 918 | goto out; | 919 | goto out; |
| 919 | 920 | ||
| 920 | memcpy(rproc->cached_table, table, tablesz); | ||
| 921 | rproc->table_ptr = rproc->cached_table; | 921 | rproc->table_ptr = rproc->cached_table; |
| 922 | 922 | ||
| 923 | /* count the number of notify-ids */ | 923 | /* count the number of notify-ids */ |
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 157a57309601..9d30809bb407 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c | |||
| @@ -248,6 +248,5 @@ void __init rproc_init_debugfs(void) | |||
| 248 | 248 | ||
| 249 | void __exit rproc_exit_debugfs(void) | 249 | void __exit rproc_exit_debugfs(void) |
| 250 | { | 250 | { |
| 251 | if (rproc_dbg) | 251 | debugfs_remove(rproc_dbg); |
| 252 | debugfs_remove(rproc_dbg); | ||
| 253 | } | 252 | } |
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 157e762c1571..70701a50ddfa 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h | |||
| @@ -107,12 +107,12 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc, | |||
| 107 | 107 | ||
| 108 | static inline | 108 | static inline |
| 109 | struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc, | 109 | struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc, |
| 110 | const struct firmware *fw) | 110 | const struct firmware *fw) |
| 111 | { | 111 | { |
| 112 | if (rproc->fw_ops->find_loaded_rsc_table) | 112 | if (rproc->fw_ops->find_loaded_rsc_table) |
| 113 | return rproc->fw_ops->find_loaded_rsc_table(rproc, fw); | 113 | return rproc->fw_ops->find_loaded_rsc_table(rproc, fw); |
| 114 | 114 | ||
| 115 | return NULL; | 115 | return NULL; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | extern const struct rproc_fw_ops rproc_elf_fw_ops; | 118 | extern const struct rproc_fw_ops rproc_elf_fw_ops; |
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h index 3c1c6444ec4b..bfbd12b41162 100644 --- a/include/linux/platform_data/remoteproc-omap.h +++ b/include/linux/platform_data/remoteproc-omap.h | |||
| @@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void); | |||
| 50 | 50 | ||
| 51 | #else | 51 | #else |
| 52 | 52 | ||
| 53 | void __init omap_rproc_reserve_cma(void) | 53 | static inline void __init omap_rproc_reserve_cma(void) |
| 54 | { | 54 | { |
| 55 | } | 55 | } |
| 56 | 56 | ||
