Skip to content

Commit 168f2e1

Browse files
committed
pstore: fix build warning for unused return value from sysfs_create_file
fs/pstore/inode.c: In function 'init_pstore_fs': fs/pstore/inode.c:266: warning: ignoring return value of 'sysfs_create_file', declared with attribute warn_unused_result Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Tony Luck <tony.luck@intel.com>
1 parent 0bb77c4 commit 168f2e1

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

‎fs/pstore/inode.c‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,28 @@ static struct file_system_type pstore_fs_type = {
256256

257257
static int __init init_pstore_fs(void)
258258
{
259-
int ret = 0;
259+
int rc = 0;
260260
struct kobject *pstorefs_kobj;
261261

262262
pstorefs_kobj = kobject_create_and_add("pstore", fs_kobj);
263-
if (!pstorefs_kobj)
264-
return -ENOMEM;
263+
if (!pstorefs_kobj) {
264+
rc = -ENOMEM;
265+
goto done;
266+
}
265267

266-
sysfs_create_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
268+
rc = sysfs_create_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
269+
if (rc)
270+
goto done1;
267271

268-
ret = register_filesystem(&pstore_fs_type);
272+
rc = register_filesystem(&pstore_fs_type);
273+
if (rc == 0)
274+
goto done;
269275

270-
if (ret) {
271-
sysfs_remove_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
272-
kobject_put(pstorefs_kobj);
273-
}
274-
275-
return ret;
276+
sysfs_remove_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
277+
done1:
278+
kobject_put(pstorefs_kobj);
279+
done:
280+
return rc;
276281
}
277282
module_init(init_pstore_fs)
278283

0 commit comments

Comments
 (0)