[API-NEXT,v1,2/4] linux-gen: packet: fix gcc errors with single segment pool

Message ID 1497488406-16652-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Add scalable scheduler for travis CI
Related show

Commit Message

Github ODP bot June 15, 2017, 1 a.m.
From: Matias Elo <matias.elo@nokia.com>


Fix (invalid) gcc errors when CONFIG_PACKET_MAX_SEGS is set to one.
https://bugs.linaro.org/show_bug.cgi?id=3013

Signed-off-by: Matias Elo <matias.elo@nokia.com>

Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 50 (nagarahalli:api-next-travis)
 ** https://github.com/Linaro/odp/pull/50
 ** Patch: https://github.com/Linaro/odp/pull/50.patch
 ** Base sha: 4f97e500a097928e308a415c32a88465adc5f5cc
 ** Merge commit sha: 95322c7b65a45928baf62cc6dd993c3a3bcdfe3a
 **/
 platform/linux-generic/odp_packet.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 01a82854..eb66af2d 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -791,7 +791,8 @@  static inline int move_data_to_head(odp_packet_hdr_t *pkt_hdr, int segs)
 
 		free_len = BASE_LEN - len;
 
-		for (src_seg = dst_seg + 1; src_seg < segs; src_seg++) {
+		for (src_seg = dst_seg + 1; CONFIG_PACKET_MAX_SEGS > 1 &&
+		     src_seg < segs; src_seg++) {
 			len = fill_seg_head(pkt_hdr, dst_seg, src_seg,
 					    free_len);
 			moved += len;
@@ -915,7 +916,7 @@  int odp_packet_extend_head(odp_packet_t *pkt, uint32_t len,
 
 				pkt_hdr = new_hdr;
 				*pkt    = packet_handle(pkt_hdr);
-			} else if (free_segs) {
+			} else if (CONFIG_PACKET_MAX_SEGS > 1 && free_segs) {
 				new_hdr = pkt_hdr->buf_hdr.seg[free_segs].hdr;
 				packet_seg_copy_md(new_hdr, pkt_hdr);