summaryrefslogtreecommitdiff
path: root/src/udev/mtd_probe/probe_smartmedia.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2012-04-04 05:18:14 +0200
committerKay Sievers <kay.sievers@vrfy.org>2012-04-04 05:21:35 +0200
commitfc863deadaf07da24f3593fca6c6e09b62cd772c (patch)
tree27ffd57657a907fb49f965e27521c803aabae65a /src/udev/mtd_probe/probe_smartmedia.c
parent3e2147858f21943d5f4a781c60f33ac22c6096ed (diff)
udev: fix gcc warnings
Diffstat (limited to 'src/udev/mtd_probe/probe_smartmedia.c')
-rw-r--r--src/udev/mtd_probe/probe_smartmedia.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/udev/mtd_probe/probe_smartmedia.c b/src/udev/mtd_probe/probe_smartmedia.c
index b3cdefc633..feadb5076c 100644
--- a/src/udev/mtd_probe/probe_smartmedia.c
+++ b/src/udev/mtd_probe/probe_smartmedia.c
@@ -36,7 +36,13 @@ static const uint8_t cis_signature[] = {
void probe_smart_media(int mtd_fd, mtd_info_t* info)
{
+ int sector_size;
+ int block_size;
+ int size_in_megs;
+ int spare_count;
char* cis_buffer = malloc(SM_SECTOR_SIZE);
+ int offset;
+ int cis_found = 0;
if (!cis_buffer)
return;
@@ -44,11 +50,9 @@ void probe_smart_media(int mtd_fd, mtd_info_t* info)
if (info->type != MTD_NANDFLASH)
goto exit;
- int sector_size = info->writesize;
- int block_size = info->erasesize;
- int size_in_megs = info->size / (1024 * 1024);
- int spare_count;
-
+ sector_size = info->writesize;
+ block_size = info->erasesize;
+ size_in_megs = info->size / (1024 * 1024);
if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE)
goto exit;
@@ -66,13 +70,8 @@ void probe_smart_media(int mtd_fd, mtd_info_t* info)
break;
}
-
- int offset;
- int cis_found = 0;
-
for (offset = 0 ; offset < block_size * spare_count ;
offset += sector_size) {
-
lseek(mtd_fd, SEEK_SET, offset);
if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){
cis_found = 1;