From: Philippe Mathieu-Daudé <f4...@amsat.org>

static code analyzer complain:

device_tree.c:155:18: warning: Null pointer passed as an argument to a 
'nonnull' parameter
    while ((de = readdir(d)) != NULL) {
                 ^~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>
Signed-off-by: Michael Tokarev <m...@tls.msk.ru>
---
 device_tree.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/device_tree.c b/device_tree.c
index 6e06320830..a24ddff02b 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -148,6 +148,7 @@ static void read_fstree(void *fdt, const char *dirname)
     d = opendir(dirname);
     if (!d) {
         error_setg(&error_fatal, "%s cannot open %s", __func__, dirname);
+        return;
     }
 
     while ((de = readdir(d)) != NULL) {
-- 
2.11.0


Reply via email to