fs/ufs/super.c:1246:22: warning: variable 'ufstype' set but not used
From: kernel test robot
Date: Fri Jul 04 2025 - 14:27:35 EST
Hi Eric,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4c06e63b92038fadb566b652ec3ec04e228931e8
commit: b70cb459890b7590c6d909da8c1e7ecfaf6535fb ufs: convert ufs to the new mount API
date: 7 weeks ago
config: i386-buildonly-randconfig-2002-20250704 (https://download.01.org/0day-ci/archive/20250704/202507042051.zr33LMmW-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250704/202507042051.zr33LMmW-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507042051.zr33LMmW-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
fs/ufs/super.c: In function 'ufs_reconfigure':
>> fs/ufs/super.c:1246:22: warning: variable 'ufstype' set but not used [-Wunused-but-set-variable]
1246 | unsigned int ufstype;
| ^~~~~~~
vim +/ufstype +1246 fs/ufs/super.c
1238
1239 static int ufs_reconfigure(struct fs_context *fc)
1240 {
1241 struct ufs_sb_private_info * uspi;
1242 struct ufs_super_block_first * usb1;
1243 struct ufs_super_block_third * usb3;
1244 struct ufs_fs_context *ctx = fc->fs_private;
1245 struct super_block *sb = fc->root->d_sb;
> 1246 unsigned int ufstype;
1247 unsigned int flags;
1248
1249 sync_filesystem(sb);
1250 mutex_lock(&UFS_SB(sb)->s_lock);
1251 uspi = UFS_SB(sb)->s_uspi;
1252 flags = UFS_SB(sb)->s_flags;
1253 usb1 = ubh_get_usb_first(uspi);
1254 usb3 = ubh_get_usb_third(uspi);
1255
1256 ufstype = UFS_SB(sb)->s_flavour;
1257
1258 if ((bool)(fc->sb_flags & SB_RDONLY) == sb_rdonly(sb)) {
1259 UFS_SB(sb)->s_on_err = ctx->on_err;
1260 mutex_unlock(&UFS_SB(sb)->s_lock);
1261 return 0;
1262 }
1263
1264 /*
1265 * fs was mouted as rw, remounting ro
1266 */
1267 if (fc->sb_flags & SB_RDONLY) {
1268 ufs_put_super_internal(sb);
1269 usb1->fs_time = ufs_get_seconds(sb);
1270 if ((flags & UFS_ST_MASK) == UFS_ST_SUN
1271 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
1272 || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
1273 ufs_set_fs_state(sb, usb1, usb3,
1274 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
1275 ubh_mark_buffer_dirty (USPI_UBH(uspi));
1276 sb->s_flags |= SB_RDONLY;
1277 } else {
1278 /*
1279 * fs was mounted as ro, remounting rw
1280 */
1281 #ifndef CONFIG_UFS_FS_WRITE
1282 pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n");
1283 mutex_unlock(&UFS_SB(sb)->s_lock);
1284 return -EINVAL;
1285 #else
1286 if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
1287 ufstype != UFS_MOUNT_UFSTYPE_SUNOS &&
1288 ufstype != UFS_MOUNT_UFSTYPE_44BSD &&
1289 ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
1290 ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
1291 pr_err("this ufstype is read-only supported\n");
1292 mutex_unlock(&UFS_SB(sb)->s_lock);
1293 return -EINVAL;
1294 }
1295 if (!ufs_read_cylinder_structures(sb)) {
1296 pr_err("failed during remounting\n");
1297 mutex_unlock(&UFS_SB(sb)->s_lock);
1298 return -EPERM;
1299 }
1300 sb->s_flags &= ~SB_RDONLY;
1301 #endif
1302 }
1303 UFS_SB(sb)->s_on_err = ctx->on_err;
1304 mutex_unlock(&UFS_SB(sb)->s_lock);
1305 return 0;
1306 }
1307
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki