regmap: fix kernel hang on regmap_bulk_write with zero val_count.
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / base / regmap / regmap.c
index f6cff3b..2f9a3d8 100644 (file)
@@ -1557,8 +1557,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
        } else {
                void *wval;
 
-               if (!val_count)
-                       return -EINVAL;
+               if (!val_count) {
+                       ret = -EINVAL;
+                       goto out;
+               }
 
                wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
                if (!wval) {