Skip to content

Commit

Permalink
hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/be6b955d50de140fcc96bd116150b435021bf567.1653225250.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Aleksa Savic <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
tititiou36 authored and groeck committed May 22, 2022
1 parent 5ab312b commit 8877ecb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwmon/aquacomputer_d5next.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8877ecb

Please sign in to comment.