diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index b903aff59af392b7bda6de21400db9fcacccf4b9..e677a1b79f95ad6ee2f562eb93dae0e3f02fa694 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1659,6 +1659,9 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, } else { void *wval; + if (!val_count) + return -EINVAL; + wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); if (!wval) { dev_err(map->dev, "Error in memory allocation\n");