diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 63b5b435bd3a..ba223736237e 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -795,11 +795,13 @@ static void __init of_unittest_property_copy(void) new = __of_prop_dup(&p1, GFP_KERNEL); unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n"); - __of_prop_free(new); + if (new) + __of_prop_free(new); new = __of_prop_dup(&p2, GFP_KERNEL); unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); - __of_prop_free(new); + if (new) + __of_prop_free(new); #endif }