author: Colin Ian King <colin.king@canonical.com> 2021-04-06 17:40:02 +0100
committer: Mark Brown <broonie@kernel.org> 2021-04-07 16:58:33 +0100
commit: 14e13b1ce92ea278fc0d7bb95b340b46cff624ab
parent: 394409aafd017adfcffd075595cb01cc456a9327
Commit Summary:
Diffstat:
1 file changed, 5 insertions, 3 deletions
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index e6343ccc6aa1..760296a4b606 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -901,9 +901,11 @@ err_alloc:
kfree(d->mask_buf);
kfree(d->status_buf);
kfree(d->status_reg_buf);
- for (i = 0; i < chip->num_virt_regs; i++)
- kfree(d->virt_buf[i]);
- kfree(d->virt_buf);
+ if (d->virt_buf) {
+ for (i = 0; i < chip->num_virt_regs; i++)
+ kfree(d->virt_buf[i]);
+ kfree(d->virt_buf);
+ }
kfree(d);
return ret;
}