Bug Summary

File:/home/joel/rtems-4.11-work/build/rtems/c/src/../../cpukit/score/src/coresemsurrender.c
Location:line 59, column 9
Description:Although the value stored to 'the_thread' is used in the enclosing expression, the value is never actually read from 'the_thread'

Annotated Source Code

1/*
2 * CORE Semaphore Handler
3 *
4 * DESCRIPTION:
5 *
6 * This package is the implementation of the CORE Semaphore Handler.
7 * This core object utilizes standard Dijkstra counting semaphores to provide
8 * synchronization and mutual exclusion capabilities.
9 *
10 * COPYRIGHT (c) 1989-1999.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * The license and distribution terms for this file may be
14 * found in the file LICENSE in this distribution or at
15 * http://www.rtems.com/license/LICENSE.
16 *
17 * $Id: coresemsurrender.c,v 1.8 2008/09/05 21:54:20 joel Exp $
18 */
19
20#if HAVE_CONFIG_H1
21#include "config.h"
22#endif
23
24#include <rtems/system.h>
25#include <rtems/score/isr.h>
26#include <rtems/score/coresem.h>
27#include <rtems/score/states.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/threadq.h>
30
31/*PAGE
32 *
33 * _CORE_semaphore_Surrender
34 *
35 * Input parameters:
36 * the_semaphore - the semaphore to be flushed
37 * id - id of parent semaphore
38 * api_semaphore_mp_support - api dependent MP support actions
39 *
40 * Output parameters:
41 * CORE_SEMAPHORE_STATUS_SUCCESSFUL - if successful
42 * core error code - if unsuccessful
43 *
44 * Output parameters:
45 */
46
47CORE_semaphore_Status _CORE_semaphore_Surrender(
48 CORE_semaphore_Control *the_semaphore,
49 Objects_Id id,
50 CORE_semaphore_API_mp_support_callout api_semaphore_mp_support
51)
52{
53 Thread_Control *the_thread;
54 ISR_Level level;
55 CORE_semaphore_Status status;
56
57 status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
58
59 if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) {
Although the value stored to 'the_thread' is used in the enclosing expression, the value is never actually read from 'the_thread'
60
61#if defined(RTEMS_MULTIPROCESSING)
62 if ( !_Objects_Is_local_id( the_thread->Object.id ) )
63 (*api_semaphore_mp_support) ( the_thread, id );
64#endif
65
66 } else {
67 _ISR_Disable( level )do { (level) = sparc_disable_interrupts(); asm volatile("" ::
: "memory"); } while (0)
;
68 if ( the_semaphore->count < the_semaphore->Attributes.maximum_count )
69 the_semaphore->count += 1;
70 else
71 status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
72 _ISR_Enable( level )do { asm volatile("" ::: "memory"); sparc_enable_interrupts( level
); } while (0)
;
73 }
74
75 return status;
76}