@@ -179,47 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb)
179
179
struct qnx4_inode_entry * rootdir ;
180
180
int rd , rl ;
181
181
int i , j ;
182
- int found = 0 ;
183
182
184
- if (* (qnx4_sb (sb )-> sb -> RootDir .di_fname ) != '/' ) {
183
+ if (* (qnx4_sb (sb )-> sb -> RootDir .di_fname ) != '/' )
185
184
return "no qnx4 filesystem (no root dir)." ;
186
- } else {
187
- QNX4DEBUG ((KERN_NOTICE "QNX4 filesystem found on dev %s.\n" , sb -> s_id ));
188
- rd = le32_to_cpu (qnx4_sb (sb )-> sb -> RootDir .di_first_xtnt .xtnt_blk ) - 1 ;
189
- rl = le32_to_cpu (qnx4_sb (sb )-> sb -> RootDir .di_first_xtnt .xtnt_size );
190
- for (j = 0 ; j < rl ; j ++ ) {
191
- bh = sb_bread (sb , rd + j ); /* root dir, first block */
192
- if (bh == NULL ) {
193
- return "unable to read root entry." ;
194
- }
195
- for (i = 0 ; i < QNX4_INODES_PER_BLOCK ; i ++ ) {
196
- rootdir = (struct qnx4_inode_entry * ) (bh -> b_data + i * QNX4_DIR_ENTRY_SIZE );
197
- if (rootdir -> di_fname != NULL ) {
198
- QNX4DEBUG ((KERN_INFO "rootdir entry found : [%s]\n" , rootdir -> di_fname ));
199
- if (!strcmp (rootdir -> di_fname ,
200
- QNX4_BMNAME )) {
201
- found = 1 ;
202
- qnx4_sb (sb )-> BitMap = kmemdup (rootdir ,
203
- sizeof (struct qnx4_inode_entry ),
204
- GFP_KERNEL );
205
- if (!qnx4_sb (sb )-> BitMap ) {
206
- brelse (bh );
207
- return "not enough memory for bitmap inode" ;
208
- }/* keep bitmap inode known */
209
- break ;
210
- }
211
- }
212
- }
185
+ QNX4DEBUG ((KERN_NOTICE "QNX4 filesystem found on dev %s.\n" , sb -> s_id ));
186
+ rd = le32_to_cpu (qnx4_sb (sb )-> sb -> RootDir .di_first_xtnt .xtnt_blk ) - 1 ;
187
+ rl = le32_to_cpu (qnx4_sb (sb )-> sb -> RootDir .di_first_xtnt .xtnt_size );
188
+ for (j = 0 ; j < rl ; j ++ ) {
189
+ bh = sb_bread (sb , rd + j ); /* root dir, first block */
190
+ if (bh == NULL )
191
+ return "unable to read root entry." ;
192
+ rootdir = (struct qnx4_inode_entry * ) bh -> b_data ;
193
+ for (i = 0 ; i < QNX4_INODES_PER_BLOCK ; i ++ , rootdir ++ ) {
194
+ QNX4DEBUG ((KERN_INFO "rootdir entry found : [%s]\n" , rootdir -> di_fname ));
195
+ if (strcmp (rootdir -> di_fname , QNX4_BMNAME ) != 0 )
196
+ continue ;
197
+ qnx4_sb (sb )-> BitMap = kmemdup (rootdir ,
198
+ sizeof (struct qnx4_inode_entry ),
199
+ GFP_KERNEL );
213
200
brelse (bh );
214
- if (found != 0 ) {
215
- break ;
216
- }
217
- }
218
- if (found == 0 ) {
219
- return "bitmap file not found." ;
201
+ if (!qnx4_sb (sb )-> BitMap )
202
+ return "not enough memory for bitmap inode" ;
203
+ /* keep bitmap inode known */
204
+ return NULL ;
220
205
}
206
+ brelse (bh );
221
207
}
222
- return NULL ;
208
+ return "bitmap file not found." ;
223
209
}
224
210
225
211
static int qnx4_fill_super (struct super_block * s , void * data , int silent )
@@ -270,7 +256,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
270
256
if (IS_ERR (root )) {
271
257
printk (KERN_ERR "qnx4: get inode failed\n" );
272
258
ret = PTR_ERR (root );
273
- goto out ;
259
+ goto outb ;
274
260
}
275
261
276
262
ret = - ENOMEM ;
@@ -283,6 +269,8 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
283
269
284
270
outi :
285
271
iput (root );
272
+ outb :
273
+ kfree (qs -> BitMap );
286
274
out :
287
275
brelse (bh );
288
276
outnobh :
0 commit comments