summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-28 00:50:27 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:15 -0400
commitdc08c661a291f5e479fdde8322a4c295c69a3aef (patch)
tree9d95c2066bd71c036144bd5a8dba56a63f1d5bb7 /fs/bcachefs
parent40f7914e8dc87f8530ebbd853036cb370656b947 (diff)
bcachefs: Use strsep() in split_devs()
Minor refactoring to fix a smatch complaint. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/fs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 73a3cebd734f..bc009ef497d0 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1595,7 +1595,7 @@ static struct bch_fs *bch2_path_to_fs(const char *path)
static char **split_devs(const char *_dev_name, unsigned *nr)
{
char *dev_name = NULL, **devs = NULL, *s;
- size_t i, nr_devs = 0;
+ size_t i = 0, nr_devs = 0;
dev_name = kstrdup(_dev_name, GFP_KERNEL);
if (!dev_name)
@@ -1610,9 +1610,7 @@ static char **split_devs(const char *_dev_name, unsigned *nr)
return NULL;
}
- for (i = 0, s = dev_name;
- s;
- (s = strchr(s, ':')) && (*s++ = '\0'))
+ while ((s = strsep(&dev_name, ":")))
devs[i++] = s;
*nr = nr_devs;