From 669c380211fabb63092ca2a80e26097de8a89dce Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 15 Sep 2010 18:00:17 +0000 Subject: [PATCH] The patch below makes it again possible to build SCST against the 2.6.23 or before kernel headers and also suppresses several compiler warnings about possibly uninitialized variables. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2129 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index 2ce518640..ad5ad043f 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -3323,6 +3323,16 @@ void scst_aen_done(struct scst_aen *aen); #ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ +static inline bool sg_is_chain(struct scatterlist *sg) +{ + return false; +} + +static inline struct scatterlist *sg_chain_ptr(struct scatterlist *sg) +{ + return NULL; +} + static inline struct page *sg_page(struct scatterlist *sg) { return sg->page; @@ -3413,8 +3423,10 @@ out: static inline int scst_get_buf_first(struct scst_cmd *cmd, uint8_t **buf) { - if (unlikely(cmd->sg == NULL)) + if (unlikely(cmd->sg == NULL)) { + *buf = NULL; return 0; + } cmd->get_sg_buf_entry_num = 0; cmd->get_sg_buf_cur_sg_entry = cmd->sg; cmd->may_need_dma_sync = 1; @@ -3433,8 +3445,10 @@ static inline void scst_put_buf(struct scst_cmd *cmd, void *buf) static inline int scst_get_out_buf_first(struct scst_cmd *cmd, uint8_t **buf) { - if (unlikely(cmd->out_sg == NULL)) + if (unlikely(cmd->out_sg == NULL)) { + *buf = NULL; return 0; + } cmd->get_sg_buf_entry_num = 0; cmd->get_sg_buf_cur_sg_entry = cmd->out_sg; cmd->may_need_dma_sync = 1; @@ -3454,8 +3468,10 @@ static inline void scst_put_out_buf(struct scst_cmd *cmd, void *buf) static inline int scst_get_sg_buf_first(struct scst_cmd *cmd, uint8_t **buf, struct scatterlist *sg, int sg_cnt) { - if (unlikely(sg == NULL)) + if (unlikely(sg == NULL)) { + *buf = NULL; return 0; + } cmd->get_sg_buf_entry_num = 0; cmd->get_sg_buf_cur_sg_entry = cmd->sg; cmd->may_need_dma_sync = 1;