#ifndef __BPF_SYS__ #define __BPF_SYS__ #include #include #include #include static inline __u64 bpf_ptr_to_u64(const void *ptr) { return (__u64)(unsigned long) ptr; } static inline int bpf(int cmd, union bpf_attr *attr, unsigned int size) { #ifdef __NR_bpf return syscall(__NR_bpf, cmd, attr, size); #else fprintf(stderr, "No bpf syscall, kernel headers too old?\n"); errno = ENOSYS; return -1; #endif } static inline int bpf_map_lookup(int fd, const void *key, void *value) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.value = bpf_ptr_to_u64(value); return bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_update(int fd, const void *key, const void *value, uint64_t flags) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.value = bpf_ptr_to_u64(value); attr.flags = flags; return bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_delete(int fd, const void *key) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); return bpf(BPF_MAP_DELETE_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_next_key(int fd, const void *key, void *next_key) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.next_key = bpf_ptr_to_u64(next_key); return bpf(BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); } static inline int bpf_map_create(enum bpf_map_type type, uint32_t size_key, uint32_t size_value, uint32_t max_elem, uint32_t flags) { union bpf_attr attr = {}; attr.map_type = type; attr.key_size = size_key; attr.value_size = size_value; attr.max_entries = max_elem; attr.map_flags = flags; return bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); } static inline int bpf_prog_load(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, char *log, size_t size_log) { union bpf_attr attr = {}; attr.prog_type = type; attr.insns = bpf_ptr_to_u64(insns); attr.insn_cnt = size_insns / sizeof(struct bpf_insn); attr.license = bpf_ptr_to_u64(license); if (size_log > 0) { attr.log_buf = bpf_ptr_to_u64(log); attr.log_size = size_log; attr.log_level = 1; log[0] = 0; } return bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); } #endif /* __BPF_SYS__ */ /sound/soc/adi/axi-spdif.c'>
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2017-01-29 12:40:52 +0100
committerKalle Valo <kvalo@codeaurora.org>2017-01-31 09:08:52 +0200
commit33e962c8871f015f5c8978384553dddcf5b81b22 (patch)
tree43aff96c2ee21d9e0fa2018457778a4de52053cd /sound/soc/adi/axi-spdif.c
parent575ddce0507789bf9830d089557d2199d2f91865 (diff)
rt2x00: fix clk_get call
clk_get() takes two arguments and might return ERR_PTR(), so we have to nullify pointer on that case, to do not break further call to clk_get_rate(). Reported-by: Felix Fietkau <nbd@nbd.name> Fixes: 34db70b92fae ("rt2x00: add copy of clk for soc devices") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'sound/soc/adi/axi-spdif.c')