All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
@ 2022-05-22 13:14 Christophe JAILLET
  2022-05-22 14:35 ` Guenter Roeck
  2022-05-22 18:34 ` Aleksa Savic
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-05-22 13:14 UTC (permalink / raw)
  To: dan.carpenter, Aleksa Savic, Jack Doan, Jean Delvare, Guenter Roeck
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-hwmon

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>
---
 drivers/hwmon/aquacomputer_d5next.c | 6 ++++--
 1 file 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);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
  2022-05-22 13:14 [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe() Christophe JAILLET
@ 2022-05-22 14:35 ` Guenter Roeck
  2022-05-22 18:34 ` Aleksa Savic
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-05-22 14:35 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dan.carpenter, Aleksa Savic, Jack Doan, Jean Delvare,
	linux-kernel, kernel-janitors, linux-hwmon

On Sun, May 22, 2022 at 03:14:23PM +0200, Christophe JAILLET wrote:
> 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>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/aquacomputer_d5next.c | 6 ++++--
>  1 file 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);
>  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
  2022-05-22 13:14 [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe() Christophe JAILLET
  2022-05-22 14:35 ` Guenter Roeck
@ 2022-05-22 18:34 ` Aleksa Savic
  2022-05-22 18:37   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Aleksa Savic @ 2022-05-22 18:34 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dan.carpenter, Jack Doan, Jean Delvare, Guenter Roeck,
	linux-kernel, kernel-janitors, linux-hwmon

Thank you Christophe!

Aleksa

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
  2022-05-22 18:34 ` Aleksa Savic
@ 2022-05-22 18:37   ` Guenter Roeck
  2022-05-22 18:53     ` Aleksa Savic
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2022-05-22 18:37 UTC (permalink / raw)
  To: Aleksa Savic, Christophe JAILLET
  Cc: dan.carpenter, Jack Doan, Jean Delvare, linux-kernel,
	kernel-janitors, linux-hwmon

On 5/22/22 11:34, Aleksa Savic wrote:
> Thank you Christophe!
> 
> Aleksa

A Reviewed-by: tag would be useful.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe()
  2022-05-22 18:37   ` Guenter Roeck
@ 2022-05-22 18:53     ` Aleksa Savic
  0 siblings, 0 replies; 5+ messages in thread
From: Aleksa Savic @ 2022-05-22 18:53 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Christophe JAILLET, dan.carpenter, Jack Doan, Jean Delvare,
	linux-kernel, kernel-janitors, linux-hwmon

On Sun, May 22, 2022 at 11:37:52AM -0700, Guenter Roeck wrote:
> On 5/22/22 11:34, Aleksa Savic wrote:
> > Thank you Christophe!
> > 
> > Aleksa
> 
> A Reviewed-by: tag would be useful.
>
> Thanks,
> Guenter

Right - that slipped my mind, sorry. For the patch:

Reviewed-by: Aleksa Savic <savicaleksa83@gmail.com>

Thanks,
Aleksa

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-22 18:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22 13:14 [PATCH] hwmon: (aquacomputer_d5next) Fix an error handling path in aqc_probe() Christophe JAILLET
2022-05-22 14:35 ` Guenter Roeck
2022-05-22 18:34 ` Aleksa Savic
2022-05-22 18:37   ` Guenter Roeck
2022-05-22 18:53     ` Aleksa Savic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.