Skip to content

Commit bcf19d1

Browse files
Al ViroKernel Patches Daemon
authored andcommitted
hypfs: swich hypfs_create_u64() to returning int
same story as for hypfs_create_str() Signed-off-by: Al Viro <[email protected]>
1 parent 3be7999 commit bcf19d1

File tree

4 files changed

+21
-26
lines changed

4 files changed

+21
-26
lines changed

arch/s390/hypfs/hypfs.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
2424

25-
extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
26-
__u64 value);
25+
extern int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value);
2726

2827
extern int hypfs_create_str(struct dentry *dir, const char *name, char *string);
2928

arch/s390/hypfs/hypfs_diag_fs.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
204204
{
205205
struct dentry *cpu_dir;
206206
char buffer[TMP_SIZE];
207-
void *rc;
207+
int rc;
208208

209209
snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_get_info_type(),
210210
cpu_info));
@@ -214,18 +214,18 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
214214
rc = hypfs_create_u64(cpu_dir, "mgmtime",
215215
cpu_info__acc_time(diag204_get_info_type(), cpu_info) -
216216
cpu_info__lp_time(diag204_get_info_type(), cpu_info));
217-
if (IS_ERR(rc))
218-
return PTR_ERR(rc);
217+
if (rc)
218+
return rc;
219219
rc = hypfs_create_u64(cpu_dir, "cputime",
220220
cpu_info__lp_time(diag204_get_info_type(), cpu_info));
221-
if (IS_ERR(rc))
222-
return PTR_ERR(rc);
221+
if (rc)
222+
return rc;
223223
if (diag204_get_info_type() == DIAG204_INFO_EXT) {
224224
rc = hypfs_create_u64(cpu_dir, "onlinetime",
225225
cpu_info__online_time(diag204_get_info_type(),
226226
cpu_info));
227-
if (IS_ERR(rc))
228-
return PTR_ERR(rc);
227+
if (rc)
228+
return rc;
229229
}
230230
diag224_idx2name(cpu_info__ctidx(diag204_get_info_type(), cpu_info), buffer);
231231
return hypfs_create_str(cpu_dir, "type", buffer);
@@ -263,7 +263,7 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
263263
{
264264
struct dentry *cpu_dir;
265265
char buffer[TMP_SIZE];
266-
void *rc;
266+
int rc;
267267

268268
snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_get_info_type(),
269269
cpu_info));
@@ -272,8 +272,8 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
272272
return PTR_ERR(cpu_dir);
273273
rc = hypfs_create_u64(cpu_dir, "mgmtime",
274274
phys_cpu__mgm_time(diag204_get_info_type(), cpu_info));
275-
if (IS_ERR(rc))
276-
return PTR_ERR(rc);
275+
if (rc)
276+
return rc;
277277
diag224_idx2name(phys_cpu__ctidx(diag204_get_info_type(), cpu_info), buffer);
278278
return hypfs_create_str(cpu_dir, "type", buffer);
279279
}

arch/s390/hypfs/hypfs_vm_fs.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919

2020
#define ATTRIBUTE(dir, name, member) \
2121
do { \
22-
void *rc; \
23-
rc = hypfs_create_u64(dir, name, member); \
24-
if (IS_ERR(rc)) \
25-
return PTR_ERR(rc); \
22+
int rc = hypfs_create_u64(dir, name, member); \
23+
if (rc) \
24+
return rc; \
2625
} while (0)
2726

2827
static int hypfs_vm_create_guest(struct dentry *systems_dir,
@@ -85,7 +84,7 @@ static int hypfs_vm_create_guest(struct dentry *systems_dir,
8584

8685
int hypfs_vm_create_files(struct dentry *root)
8786
{
88-
struct dentry *dir, *file;
87+
struct dentry *dir;
8988
struct diag2fc_data *data;
9089
unsigned int count = 0;
9190
int rc, i;
@@ -110,11 +109,9 @@ int hypfs_vm_create_files(struct dentry *root)
110109
rc = PTR_ERR(dir);
111110
goto failed;
112111
}
113-
file = hypfs_create_u64(dir, "count", data->lcpus);
114-
if (IS_ERR(file)) {
115-
rc = PTR_ERR(file);
112+
rc = hypfs_create_u64(dir, "count", data->lcpus);
113+
if (rc)
116114
goto failed;
117-
}
118115

119116
/* guests */
120117
dir = hypfs_mkdir(root, "systems");

arch/s390/hypfs/inode.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,7 @@ static struct dentry *hypfs_create_update_file(struct dentry *dir)
377377
return dentry;
378378
}
379379

380-
struct dentry *hypfs_create_u64(struct dentry *dir,
381-
const char *name, __u64 value)
380+
int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value)
382381
{
383382
char *buffer;
384383
char tmp[TMP_SIZE];
@@ -387,15 +386,15 @@ struct dentry *hypfs_create_u64(struct dentry *dir,
387386
snprintf(tmp, TMP_SIZE, "%llu\n", (unsigned long long int)value);
388387
buffer = kstrdup(tmp, GFP_KERNEL);
389388
if (!buffer)
390-
return ERR_PTR(-ENOMEM);
389+
return -ENOMEM;
391390
dentry =
392391
hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE);
393392
if (IS_ERR(dentry)) {
394393
kfree(buffer);
395-
return ERR_PTR(-ENOMEM);
394+
return -ENOMEM;
396395
}
397396
hypfs_add_dentry(dentry);
398-
return dentry;
397+
return 0;
399398
}
400399

401400
int hypfs_create_str(struct dentry *dir, const char *name, char *string)

0 commit comments

Comments
 (0)