logger: handle error values from filp_open()
authorŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 10 Sep 2021 18:02:53 +0000 (20:02 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 16 Sep 2021 20:34:51 +0000 (22:34 +0200)
filp_open() may return -errno, so check for that instead of checking
for NULL.

Change-Id: I5a694555bcd082506330e08f48ed4b7043c4e120
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
kernel/logger.c

index 202703c..eb287e4 100644 (file)
@@ -484,9 +484,8 @@ static struct file *make_new_file(struct file *file)
 
        nfile = filp_open(p, O_WRONLY, 0);
        kfree(pbuf);
-       if (!nfile) {
-               return ERR_PTR(-EFAULT);
-       }
+       if (IS_ERR(nfile))
+               return nfile;
 
        nwriter = nfile->private_data;
        nwriter->prio = writer->prio;