diff options
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efivars.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 1b9a6e17e3dc..bea32d1ef7d5 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -1163,15 +1163,22 @@ static struct dentry_operations efivarfs_d_ops = { | |||
1163 | 1163 | ||
1164 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | 1164 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) |
1165 | { | 1165 | { |
1166 | struct dentry *d; | ||
1166 | struct qstr q; | 1167 | struct qstr q; |
1168 | int err; | ||
1167 | 1169 | ||
1168 | q.name = name; | 1170 | q.name = name; |
1169 | q.len = strlen(name); | 1171 | q.len = strlen(name); |
1170 | 1172 | ||
1171 | if (efivarfs_d_hash(NULL, NULL, &q)) | 1173 | err = efivarfs_d_hash(NULL, NULL, &q); |
1172 | return NULL; | 1174 | if (err) |
1175 | return ERR_PTR(err); | ||
1176 | |||
1177 | d = d_alloc(parent, &q); | ||
1178 | if (d) | ||
1179 | return d; | ||
1173 | 1180 | ||
1174 | return d_alloc(parent, &q); | 1181 | return ERR_PTR(-ENOMEM); |
1175 | } | 1182 | } |
1176 | 1183 | ||
1177 | static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | 1184 | static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -1181,6 +1188,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1181 | struct efivar_entry *entry, *n; | 1188 | struct efivar_entry *entry, *n; |
1182 | struct efivars *efivars = &__efivars; | 1189 | struct efivars *efivars = &__efivars; |
1183 | char *name; | 1190 | char *name; |
1191 | int err = -ENOMEM; | ||
1184 | 1192 | ||
1185 | efivarfs_sb = sb; | 1193 | efivarfs_sb = sb; |
1186 | 1194 | ||
@@ -1231,8 +1239,10 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1231 | goto fail_name; | 1239 | goto fail_name; |
1232 | 1240 | ||
1233 | dentry = efivarfs_alloc_dentry(root, name); | 1241 | dentry = efivarfs_alloc_dentry(root, name); |
1234 | if (!dentry) | 1242 | if (IS_ERR(dentry)) { |
1243 | err = PTR_ERR(dentry); | ||
1235 | goto fail_inode; | 1244 | goto fail_inode; |
1245 | } | ||
1236 | 1246 | ||
1237 | /* copied by the above to local storage in the dentry. */ | 1247 | /* copied by the above to local storage in the dentry. */ |
1238 | kfree(name); | 1248 | kfree(name); |
@@ -1259,7 +1269,7 @@ fail_inode: | |||
1259 | fail_name: | 1269 | fail_name: |
1260 | kfree(name); | 1270 | kfree(name); |
1261 | fail: | 1271 | fail: |
1262 | return -ENOMEM; | 1272 | return err; |
1263 | } | 1273 | } |
1264 | 1274 | ||
1265 | static struct dentry *efivarfs_mount(struct file_system_type *fs_type, | 1275 | static struct dentry *efivarfs_mount(struct file_system_type *fs_type, |