There are some questionable coding styles in this function. It looks quite odd to deref a pointer with array indexing that only uses the first element. Also, destroying an input/output variable halfway through the function and then overwriting it on success is not clear. It's better to use a local variable and the kernel macros to step through each bit set in a bitmask and clearly show where outputs are set.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -49,8 +49,9 @@ extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, · 48 unmodified lines | ||
| 49 | 49 | extern int qcom_scm_pas_auth_and_reset(u32 peripheral); |
| 50 | 50 | extern int qcom_scm_pas_shutdown(u32 peripheral); |
| 51 | 51 | extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
| 52 | − unsigned int *src, struct qcom_scm_vmperm *newvm, | |
| 53 | − int dest_cnt); | |
| 52 | + unsigned int *src, | |
| 53 | + const struct qcom_scm_vmperm *newvm, | |
| 54 | + unsigned int dest_cnt); | |
| 54 | 55 | extern void qcom_scm_cpu_power_down(u32 flags); |
| 55 | 56 | extern u32 qcom_scm_get_version(void); |
| 56 | 57 | extern int qcom_scm_set_remote_state(u32 state, u32 id); |
| @@ -87,8 +88,8 @@ qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; } · 30 unmodified lines | ||
| 87 | 88 | static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; } |
| 88 | 89 | static inline int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
| 89 | 90 | unsigned int *src, |
| 90 | − struct qcom_scm_vmperm *newvm, | |
| 91 | − int dest_cnt) { return -ENODEV; } | |
| 91 | + const struct qcom_scm_vmperm *newvm, | |
| 92 | + unsigned int dest_cnt) { return -ENODEV; } | |
| 92 | 93 | static inline void qcom_scm_cpu_power_down(u32 flags) {} |
| 93 | 94 | static inline u32 qcom_scm_get_version(void) { return 0; } |
| 94 | 95 | static inline u32 |