[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36a3daf7-d519-7669-13bf-4c59c11c2b97@wanadoo.fr>
Date: Sat, 2 Sep 2023 18:36:17 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: linux@...ssschuh.net >> Thomas Weißschuh
<linux@...ssschuh.net>
Cc: dgilbert@...erlog.com, jdelvare@...e.com,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, linux@...ck-us.net
Subject: Re: [PATCH v4] hwmon: add POWER-Z driver
Le 02/09/2023 à 09:47, Thomas Weißschuh a écrit :
> POWER-Z is a series of devices to monitor power characteristics of
> USB-C connections and display those on a on-device display.
> Some of the devices, notably KM002C and KM003C, contain an additional
> port which exposes the measurements via USB.
>
> This is a driver for this monitor port.
>
> It was developed and tested with the KM003C.
>
> Signed-off-by: Thomas Weißschuh <linux-9XfqOkM5JgxKQ7RDE2T8Pw@...lic.gmane.org>
> ---
...
> +static int powerz_probe(struct usb_interface *intf,
> + const struct usb_device_id *id)
> +{
> + struct powerz_priv *priv;
> + struct device *hwmon_dev;
> + struct device *parent;
> +
> + parent = &intf->dev;
> +
> + priv = devm_kzalloc(parent, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->urb = usb_alloc_urb(0, GFP_KERNEL);
> + if (!priv->urb)
> + return -ENOMEM;
> + mutex_init(&priv->mutex);
> + priv->status = -ETIMEDOUT;
> + init_completion(&priv->completion);
> +
> + hwmon_dev =
> + devm_hwmon_device_register_with_info(parent, DRIVER_NAME, priv,
> + &powerz_chip_info, NULL);
> + usb_set_intfdata(intf, priv);
> +
> + return PTR_ERR_OR_ZERO(hwmon_dev);
Hi,
If 'hwmon_dev' is an PTR_ERR, priv->urb leaks.
CJ
> +}
> +
...
Powered by blists - more mailing lists