staging:android:ion: Fix comparison with NULL
authorYannis Damigos <giannis.damigos@gmail.com>
Tue, 27 Sep 2016 07:38:23 +0000 (10:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Sep 2016 11:14:48 +0000 (13:14 +0200)
This patch fixes the following comparison with NULL issues:

CHECK: Comparison to NULL could be written "compatible[i].name"
+ for (i = 0; compatible[i].name != NULL; i++) {

CHECK: Comparison to NULL could be written "!compatible[i].name"
+ if (compatible[i].name == NULL)

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_of.c

index 826e756452d0be933a528f1ad7749fbb66ab3451..a8050c6241fbcbf36d63bf408ade3c1d66acfe0a 100644 (file)
@@ -31,12 +31,12 @@ static int ion_parse_dt_heap_common(struct device_node *heap_node,
 {
        int i;
 
-       for (i = 0; compatible[i].name != NULL; i++) {
+       for (i = 0; compatible[i].name; i++) {
                if (of_device_is_compatible(heap_node, compatible[i].compat))
                        break;
        }
 
-       if (compatible[i].name == NULL)
+       if (!compatible[i].name)
                return -ENODEV;
 
        heap->id = compatible[i].heap_id;