diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-27 14:09:48 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-27 14:09:48 +1100 |
commit | 2230176f5a678dc8612e1bc6830fc39fb719b79b (patch) | |
tree | 56f97e02ab7c0b24e5c064132ec71555dbcf6a23 | |
parent | 437701274b0e2f816b6f63f4bb6b9525c5f561ee (diff) | |
download | skiboot-2230176f5a678dc8612e1bc6830fc39fb719b79b.zip skiboot-2230176f5a678dc8612e1bc6830fc39fb719b79b.tar.gz skiboot-2230176f5a678dc8612e1bc6830fc39fb719b79b.tar.bz2 |
Liberally sprinkle attribute((warn_unused_result)) around the place
None of these actually produce any warnings. My next patch will.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | include/centaur.h | 4 | ||||
-rw-r--r-- | include/errorlog.h | 2 | ||||
-rw-r--r-- | include/fsp-elog.h | 10 | ||||
-rw-r--r-- | include/fsp.h | 4 | ||||
-rw-r--r-- | include/mem_region-malloc.h | 12 | ||||
-rw-r--r-- | include/pel.h | 3 | ||||
-rw-r--r-- | include/pool.h | 5 |
7 files changed, 22 insertions, 18 deletions
diff --git a/include/centaur.h b/include/centaur.h index 4a5e52c..b524c51 100644 --- a/include/centaur.h +++ b/include/centaur.h @@ -17,8 +17,8 @@ #ifndef __CENTAUR_H #define __CENTAUR_H -extern int64_t centaur_xscom_read(uint32_t id, uint64_t pcb_addr, uint64_t *val); -extern int64_t centaur_xscom_write(uint32_t id, uint64_t pcb_addr, uint64_t val); +extern int64_t centaur_xscom_read(uint32_t id, uint64_t pcb_addr, uint64_t *val) __warn_unused_result; +extern int64_t centaur_xscom_write(uint32_t id, uint64_t pcb_addr, uint64_t val) __warn_unused_result; extern void centaur_init(void); #endif /* __CENTAUR_H */ diff --git a/include/errorlog.h b/include/errorlog.h index 622a51a..fcfb215 100644 --- a/include/errorlog.h +++ b/include/errorlog.h @@ -164,7 +164,7 @@ void log_error(struct opal_err_info *e_info, void *data, uint16_t size, int opal_elog_update_user_dump(struct errorlog *buf, unsigned char *data, uint32_t tag, uint16_t size); -struct errorlog *opal_elog_create(struct opal_err_info *e_info); +struct errorlog *opal_elog_create(struct opal_err_info *e_info) __warn_unused_result; /* Called by the backend after an error has been logged by the * backend. If the error could not be logged successfully success is diff --git a/include/fsp-elog.h b/include/fsp-elog.h index 0610a77..d1f9147 100644 --- a/include/fsp-elog.h +++ b/include/fsp-elog.h @@ -213,19 +213,19 @@ severity, subtype, callout_func) struct opal_err_info err_##reason = \ #define e_info(reason_code) err_##reason_code -struct errorlog *opal_elog_create(struct opal_err_info *e_info); +struct errorlog *opal_elog_create(struct opal_err_info *e_info) __warn_unused_result; int opal_elog_update_user_dump(struct errorlog *buf, unsigned char *data, uint32_t tag, uint16_t size); -int elog_fsp_commit(struct errorlog *buf); +int elog_fsp_commit(struct errorlog *buf) __warn_unused_result; -bool opal_elog_info(uint64_t *opal_elog_id, uint64_t *opal_elog_size); +bool opal_elog_info(uint64_t *opal_elog_id, uint64_t *opal_elog_size) __warn_unused_result; bool opal_elog_read(uint64_t *buffer, uint64_t opal_elog_size, - uint64_t opal_elog_id); + uint64_t opal_elog_id) __warn_unused_result; -bool opal_elog_ack(uint64_t ack_id); +bool opal_elog_ack(uint64_t ack_id) __warn_unused_result; void opal_resend_pending_logs(void); diff --git a/include/fsp.h b/include/fsp.h index e41498e..b8d4dc6 100644 --- a/include/fsp.h +++ b/include/fsp.h @@ -631,8 +631,8 @@ extern bool fsp_present(void); * WARNING: Do _NOT_ use free() on an fsp_msg, use fsp_freemsg() * instead as we will eventually use pre-allocated message pools */ -extern struct fsp_msg *fsp_allocmsg(bool alloc_response); -extern struct fsp_msg *fsp_mkmsg(u32 cmd_sub_mod, u8 add_words, ...); +extern struct fsp_msg *fsp_allocmsg(bool alloc_response) __warn_unused_result; +extern struct fsp_msg *fsp_mkmsg(u32 cmd_sub_mod, u8 add_words, ...) __warn_unused_result; /* Populate a pre-allocated msg */ extern void fsp_fillmsg(struct fsp_msg *msg, u32 cmd_sub_mod, u8 add_words, ...); diff --git a/include/mem_region-malloc.h b/include/mem_region-malloc.h index 9c772d2..58027ae 100644 --- a/include/mem_region-malloc.h +++ b/include/mem_region-malloc.h @@ -17,15 +17,17 @@ #ifndef __MEM_REGION_MALLOC_H #define __MEM_REGION_MALLOC_H +#include <compiler.h> + #define __loc2(line) #line #define __loc(line) __loc2(line) #define __location__ __FILE__ ":" __loc(__LINE__) -void *__malloc(size_t size, const char *location); -void *__zalloc(size_t size, const char *location); -void *__realloc(void *ptr, size_t size, const char *location); +void *__malloc(size_t size, const char *location) __warn_unused_result; +void *__zalloc(size_t size, const char *location) __warn_unused_result; +void *__realloc(void *ptr, size_t size, const char *location) __warn_unused_result; void __free(void *ptr, const char *location); -void *__memalign(size_t boundary, size_t size, const char *location); +void *__memalign(size_t boundary, size_t size, const char *location) __warn_unused_result; #define malloc(size) __malloc(size, __location__) #define zalloc(size) __zalloc(size, __location__) @@ -34,7 +36,7 @@ void *__memalign(size_t boundary, size_t size, const char *location); #define memalign(boundary, size) __memalign(boundary, size, __location__) void *__local_alloc(unsigned int chip, size_t size, size_t align, - const char *location); + const char *location) __warn_unused_result; #define local_alloc(chip_id, size, align) \ __local_alloc((chip_id), (size), (align), __location__) diff --git a/include/pel.h b/include/pel.h index 3acc3d1..1213c43 100644 --- a/include/pel.h +++ b/include/pel.h @@ -16,6 +16,7 @@ #ifndef __PEL_H #define __PEL_H +#include <compiler.h> #include <errorlog.h> /* Data Structures for PEL data. */ @@ -174,6 +175,6 @@ struct opal_user_section { size_t pel_size(struct errorlog *elog_data); int create_pel_log(struct errorlog *elog_data, char *pel_buffer, - size_t pel_buffer_size); + size_t pel_buffer_size) __warn_unused_result; #endif diff --git a/include/pool.h b/include/pool.h index 89ef967..11730a9 100644 --- a/include/pool.h +++ b/include/pool.h @@ -3,6 +3,7 @@ #include <ccan/list/list.h> #include <stddef.h> +#include <compiler.h> struct pool { void *buf; @@ -14,8 +15,8 @@ struct pool { enum pool_priority {POOL_NORMAL, POOL_HIGH}; -void* pool_get(struct pool *pool, enum pool_priority priority); +void* pool_get(struct pool *pool, enum pool_priority priority) __warn_unused_result; void pool_free_object(struct pool *pool, void *obj); -int pool_init(struct pool *pool, size_t obj_size, int count, int reserved); +int pool_init(struct pool *pool, size_t obj_size, int count, int reserved) __warn_unused_result; #endif /* __POOL_H */ |