Re: [RFC:PATCH 002/002] EXT3: Fix sparse warnings

From: Alexey Dobriyan
Date: Fri Sep 08 2006 - 18:15:07 EST


On Fri, Sep 08, 2006 at 03:39:30PM -0600, Dave Kleikamp wrote:
> EXT3: Fix sparse warnings

> --- linux001/fs/ext3/resize.c
> +++ linux002/fs/ext3/resize.c

> @@ -380,7 +380,7 @@ static int add_new_gdb(handle_t *handle,
> struct buffer_head *dind;
> int gdbackups;
> struct ext3_iloc iloc;
> - __u32 *data;
> + __le32 *data;
> int err;
>
> if (test_opt(sb, DEBUG))
> @@ -410,14 +410,14 @@ static int add_new_gdb(handle_t *handle,
> goto exit_bh;
> }
>
> - data = EXT3_I(inode)->i_data + EXT3_DIND_BLOCK;
> + data = (__le32 *)(EXT3_I(inode)->i_data + EXT3_DIND_BLOCK);

Why cast is needed? i_data is __le32 * already.

> - data = (__u32 *)dind->b_data;
> + data = (__le32 *)dind->b_data;
> if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
> ext3_warning(sb, __FUNCTION__,
> "new group %u GDT block "E3FSBLK" not reserved",
> @@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *
> struct buffer_head *dind;
> struct ext3_iloc iloc;
> ext3_fsblk_t blk;
> - __u32 *data, *end;
> + __le32 *data, *end;
> int gdbackups = 0;
> int res, i;
> int err;
> @@ -528,7 +528,7 @@ static int reserve_backup_gdb(handle_t *
> if (!primary)
> return -ENOMEM;
>
> - data = EXT3_I(inode)->i_data + EXT3_DIND_BLOCK;
> + data = (__le32 *)(EXT3_I(inode)->i_data + EXT3_DIND_BLOCK);

Ditto.

> --- linux001/fs/ext3/super.c
> +++ linux002/fs/ext3/super.c
> @@ -2330,13 +2330,14 @@ static int ext3_remount (struct super_bl
>
> ext3_mark_recovery_complete(sb, es);
> } else {
> - __le32 ret;
> - if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
> + int ret;
> + __le32 ret_le;
> + if ((ret_le = EXT3_HAS_RO_COMPAT_FEATURE(sb,
> ~EXT3_FEATURE_RO_COMPAT_SUPP))) {
> printk(KERN_WARNING "EXT3-fs: %s: couldn't "
> "remount RDWR because of unsupported "
> "optional features (%x).\n",
> - sb->s_id, le32_to_cpu(ret));
> + sb->s_id, le32_to_cpu(ret_le));
> err = -EROFS;
> goto restore_opts;
> }

Get rid of "err = ret;" assignment below. It would be cleaner than
introducing new var.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/