summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-05-22 16:14:23 +0300
committerGuenter Roeck <linux@roeck-us.net>2022-05-22 22:25:55 +0300
commit8877ecb0fc8d7662218a8e7ebb0650f320467935 (patch)
tree581038cd05d1753cbe042cc46162c9d7a625756f /drivers/hwmon
parent5ab312b3a8fef467e807e8d7672e65cabe2376fd (diff)
downloadlinux-8877ecb0fc8d7662218a8e7ebb0650f320467935.tar.xz
hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
If no memory can be allocated, some resources still need to be released as already done in the other error handling paths. Fixes: 752b927951ea ("hwmon: (aquacomputer_d5next) Add support for Aquacomputer Octo") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/be6b955d50de140fcc96bd116150b435021bf567.1653225250.git.christophe.jaillet@wanadoo.fr Reviewed-by: Aleksa Savic <savicaleksa83@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/aquacomputer_d5next.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index 7d2e7279abfb..a0e69f7ece36 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -783,8 +783,10 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
priv->name = aqc_device_names[priv->kind];
priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL);
- if (!priv->buffer)
- return -ENOMEM;
+ if (!priv->buffer) {
+ ret = -ENOMEM;
+ goto fail_and_close;
+ }
mutex_init(&priv->mutex);