Skip to content

Commit 8877ecb

Browse files
tititiou36groeck
authored andcommitted
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: 752b927 ("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>
1 parent 5ab312b commit 8877ecb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/hwmon/aquacomputer_d5next.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,10 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
783783
priv->name = aqc_device_names[priv->kind];
784784

785785
priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL);
786-
if (!priv->buffer)
787-
return -ENOMEM;
786+
if (!priv->buffer) {
787+
ret = -ENOMEM;
788+
goto fail_and_close;
789+
}
788790

789791
mutex_init(&priv->mutex);
790792

0 commit comments

Comments
 (0)