Bug Summary

File:/home/joel/rtems-4.11-work/build/rtems/c/src/../../cpukit/sapi/src/io.c
Location:line 83, column 3
Description:Value stored to 'number_of_drivers' is never read

Annotated Source Code

1/*
2 * Input/Output Manager - Initialize Device Driver Subsystem
3 *
4 * COPYRIGHT (c) 1989-2008.
5 * On-Line Applications Research Corporation (OAR).
6 *
7 * The license and distribution terms for this file may be
8 * found in the file LICENSE in this distribution or at
9 * http://www.rtems.com/license/LICENSE.
10 *
11 * $Id: io.c,v 1.31 2009/11/29 13:51:52 ralf Exp $
12 */
13
14#if HAVE_CONFIG_H1
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/config.h>
20#include <rtems/io.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24
25#include <string.h>
26
27/*
28 * _IO_Manager_initialization
29 *
30 * The IO manager has been extended to support runtime driver
31 * registration. The driver table is now allocated in the
32 * workspace.
33 *
34 */
35
36void _IO_Manager_initialization(void)
37{
38 uint32_t index;
39 rtems_driver_address_table *driver_table;
40 uint32_t drivers_in_table;
41 uint32_t number_of_drivers;
42
43 driver_table = Configuration.Device_driver_table;
44 drivers_in_table = Configuration.number_of_device_drivers;
45 number_of_drivers = Configuration.maximum_drivers;
46
47 /*
48 * If the user claims there are less drivers than are actually in
49 * the table, then let's just go with the table's count.
50 */
51 if ( number_of_drivers <= drivers_in_table )
52 number_of_drivers = drivers_in_table;
53
54 /*
55 * If the maximum number of driver is the same as the number in the
56 * table, then we do not have to copy the driver table. They can't
57 * register any dynamically.
58 */
59 if ( number_of_drivers == drivers_in_table ) {
60 _IO_Driver_address_table = driver_table;
61 _IO_Number_of_drivers = number_of_drivers;
62 return;
63 }
64
65 /*
66 * The application requested extra slots in the driver table, so we
67 * have to allocate a new driver table and copy theirs to it.
68 */
69
70 _IO_Driver_address_table = (rtems_driver_address_table *)
71 _Workspace_Allocate_or_fatal_error(
72 sizeof( rtems_driver_address_table ) * ( number_of_drivers )
73 );
74 _IO_Number_of_drivers = number_of_drivers;
75
76 memset(
77 _IO_Driver_address_table, 0,
78 sizeof( rtems_driver_address_table ) * ( number_of_drivers )
79 );
80
81 for ( index = 0 ; index < drivers_in_table ; index++ )
82 _IO_Driver_address_table[index] = driver_table[index];
83 number_of_drivers = drivers_in_table;
Value stored to 'number_of_drivers' is never read
84}
85
86/*
87 * _IO_Initialize_all_drivers
88 *
89 * This routine initializes all device drivers
90 *
91 * Input Paramters: NONE
92 *
93 * Output Parameters: NONE
94 */
95
96void _IO_Initialize_all_drivers( void )
97{
98 rtems_device_major_number major;
99
100 for ( major=0 ; major < _IO_Number_of_drivers ; major ++ )
101 (void) rtems_io_initialize( major, 0, NULL((void*)0) );
102}