Bug Summary

File:/home/joel/rtems-4.11-work/build/rtems/c/src/../../cpukit/libmisc/monitor/mon-driver.c
Location:line 124, column 5
Description:Value stored to 'length' is never read

Annotated Source Code

1/*
2 * RTEMS monitor IO (device drivers) support
3 *
4 * There are 2 "driver" things the monitor knows about.
5 *
6 * 1. Regular RTEMS drivers.
7 * This is a table indexed by major device number and
8 * containing driver entry points only.
9 *
10 * 2. Driver name table.
11 * A separate table of names for drivers.
12 * The table converts driver names to a major number
13 * as index into the driver table and a minor number
14 * for an argument to driver.
15 *
16 * Drivers are displayed with 'driver' command.
17 * Names are displayed with 'name' command.
18 *
19 * $Id: mon-driver.c,v 1.18 2009/10/02 15:54:47 ralf Exp $
20 */
21
22#ifdef HAVE_CONFIG_H1
23#include "config.h"
24#endif
25
26#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
27#include <rtems.h>
28
29#include <rtems/monitor.h>
30
31#include <stdio.h>
32#include <stdlib.h> /* strtoul() */
33#include <inttypes.h>
34
35#define DATACOL15 15
36#define CONTCOL15 DATACOL15 /* continued col */
37
38
39void
40rtems_monitor_driver_canonical(
41 rtems_monitor_driver_t *canonical_driver,
42 void *driver_void
43)
44{
45 rtems_driver_address_table *d = (rtems_driver_address_table *) driver_void;
46
47 rtems_monitor_symbol_canonical_by_value(&canonical_driver->initialization,
48 (void *) d->initialization_entry);
49
50 rtems_monitor_symbol_canonical_by_value(&canonical_driver->open,
51 (void *) d->open_entry);
52 rtems_monitor_symbol_canonical_by_value(&canonical_driver->close,
53 (void *) d->close_entry);
54 rtems_monitor_symbol_canonical_by_value(&canonical_driver->read,
55 (void *) d->read_entry);
56 rtems_monitor_symbol_canonical_by_value(&canonical_driver->write,
57 (void *) d->write_entry);
58 rtems_monitor_symbol_canonical_by_value(&canonical_driver->control,
59 (void *) d->control_entry);
60}
61
62
63void *
64rtems_monitor_driver_next(
65 void *object_info __attribute__((unused)),
66 rtems_monitor_driver_t *canonical_driver,
67 rtems_id *next_id
68)
69{
70 rtems_configuration_table *c = &Configuration;
71 uint32_t n = rtems_object_id_get_index(*next_id)_Objects_Get_index( *next_id );
72
73 if (n >= c->number_of_device_drivers)
74 goto failed;
75
76 _Thread_Disable_dispatch();
77
78 /*
79 * dummy up a fake id and name for this item
80 */
81
82 canonical_driver->id = n;
83 canonical_driver->name = rtems_build_name('-', '-', '-', '-')( (uint32_t)('-') << 24 | (uint32_t)('-') << 16 |
(uint32_t)('-') << 8 | (uint32_t)('-') )
;
84
85 *next_id += 1;
86 return (void *) (c->Device_driver_table + n);
87
88failed:
89 *next_id = RTEMS_OBJECT_ID_FINAL((Objects_Id)~0);
90 return 0;
91}
92
93
94void
95rtems_monitor_driver_dump_header(
96 bool_Bool verbose __attribute__((unused))
97)
98{
99 fprintf(stdoutstdout,"\
100 Major Entry points\n");
101/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
1020 1 2 3 4 5 6 7 */
103 rtems_monitor_separator();
104}
105
106void
107rtems_monitor_driver_dump(
108 rtems_monitor_driver_t *monitor_driver,
109 bool_Bool verbose
110)
111{
112 uint32_t length = 0;
113
114#if defined(RTEMS_USE_16_BIT_OBJECT)
115 length += fprintf(stdoutstdout," %" PRId16"d" "", monitor_driver->id);
116#else
117 length += fprintf(stdoutstdout," %" PRId32"d" "", monitor_driver->id);
118#endif
119 length += rtems_monitor_pad(13, length);
120 length += fprintf(stdoutstdout,"init: ");
121 length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
122 length += fprintf(stdoutstdout,"; control: ");
123 length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
124 length += fprintf(stdoutstdout,"\n");
Value stored to 'length' is never read
125 length = 0;
126
127 length += rtems_monitor_pad(13, length);
128
129 length += fprintf(stdoutstdout,"open: ");
130 length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
131 length += fprintf(stdoutstdout,"; close: ");
132 length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
133 length += fprintf(stdoutstdout,"\n");
134 length = 0;
135
136 length += rtems_monitor_pad(13, length);
137
138 length += fprintf(stdoutstdout,"read: ");
139 length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
140 length += fprintf(stdoutstdout,"; write: ");
141 length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
142 length += fprintf(stdoutstdout,"\n");
143 length = 0;
144}