mirror of
https://github.com/AltraMayor/f3.git
synced 2025-08-03 18:46:00 -04:00
f3probe: avoid compiler warning
When using -O2, GCC was issuing the following warning: cc -O2 -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o f3probe.o f3probe.c f3probe.c: In function ‘main’: f3probe.c:446:13: warning: ‘sdev’ may be used uninitialized in this function [-Wmaybe-uninitialized] sdev_flush(sdev); ^ f3probe.c:369:30: note: ‘sdev’ was declared here struct device *dev, *pdev, *sdev; ^ NOTE: The warning was wrong. GCC could not follow that @args->save being true implied @sdev to not be NULL. This patch addresses one of the issues discussed here: https://github.com/AltraMayor/f3/issues/34
This commit is contained in:
parent
52e252f5d6
commit
77d2ceb374
@ -393,6 +393,7 @@ static int test_device(struct args *args)
|
|||||||
pdev = NULL;
|
pdev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdev = NULL;
|
||||||
if (args->save) {
|
if (args->save) {
|
||||||
sdev = create_safe_device(dev,
|
sdev = create_safe_device(dev,
|
||||||
probe_device_max_blocks(dev), args->min_mem);
|
probe_device_max_blocks(dev), args->min_mem);
|
||||||
@ -434,7 +435,7 @@ static int test_device(struct args *args)
|
|||||||
&read_count, &read_time_us,
|
&read_count, &read_time_us,
|
||||||
&write_count, &write_time_us,
|
&write_count, &write_time_us,
|
||||||
&reset_count, &reset_time_us);
|
&reset_count, &reset_time_us);
|
||||||
if (args->save) {
|
if (sdev) {
|
||||||
uint64_t very_last_pos = real_size_byte >> block_order;
|
uint64_t very_last_pos = real_size_byte >> block_order;
|
||||||
printf("Probe finished, recovering blocks...");
|
printf("Probe finished, recovering blocks...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user