Skip to content

Commit 2531f65

Browse files
ikegami-tigaw
authored andcommitted
nvme: use _cleanup_free_ type buffer for get-feature command
Reduce the buffer free calls. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent 02c6260 commit 2531f65

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

nvme.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -4642,8 +4642,8 @@ static int get_feature_id_changed(struct nvme_dev *dev, struct feat_cfg cfg,
46424642
int err_def = 0;
46434643
__u32 result;
46444644
__u32 result_def;
4645-
void *buf = NULL;
4646-
void *buf_def = NULL;
4645+
_cleanup_free_ void *buf = NULL;
4646+
_cleanup_free_ void *buf_def = NULL;
46474647

46484648
if (changed)
46494649
cfg.sel = 0;
@@ -4662,9 +4662,6 @@ static int get_feature_id_changed(struct nvme_dev *dev, struct feat_cfg cfg,
46624662
(buf && buf_def && !strcmp(buf, buf_def)))
46634663
get_feature_id_print(cfg, err, result, buf);
46644664

4665-
free(buf);
4666-
free(buf_def);
4667-
46684665
return err;
46694666
}
46704667

0 commit comments

Comments
 (0)