lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 29 Apr 2019 13:36:01 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Andrey Smirnov <andrew.smirnov@...il.com>
Cc:     linux-pm@...r.kernel.org,
        Enric Balletbo Serra <enric.balletbo@...labora.com>,
        Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Fabio Estevam <fabio.estevam@....com>,
        Sebastian Reichel <sre@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] power: supply: Add driver for Microchip UCS1002

On Mon, Apr 29, 2019 at 12:53:48PM -0700, Andrey Smirnov wrote:
> Add driver for Microchip UCS1002 Programmable USB Port Power
> Controller with Charger Emulation. The driver exposed a power supply
> device to control/monitor various parameter of the device as well as a
> regulator to allow controlling VBUS line.
> 
> Signed-off-by: Enric Balletbo Serra <enric.balletbo@...labora.com>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> Cc: Chris Healy <cphealy@...il.com>
> Cc: Lucas Stach <l.stach@...gutronix.de>
> Cc: Fabio Estevam <fabio.estevam@....com>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Cc: Sebastian Reichel <sre@...nel.org>
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-pm@...r.kernel.org
> ---
>  drivers/power/supply/Kconfig         |   9 +
>  drivers/power/supply/Makefile        |   1 +
>  drivers/power/supply/ucs1002_power.c | 646 +++++++++++++++++++++++++++
>  3 files changed, 656 insertions(+)
>  create mode 100644 drivers/power/supply/ucs1002_power.c
> 
> diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
> index e901b9879e7e..c614c8a196f3 100644
> --- a/drivers/power/supply/Kconfig
> +++ b/drivers/power/supply/Kconfig
> @@ -660,4 +660,13 @@ config FUEL_GAUGE_SC27XX
>  	 Say Y here to enable support for fuel gauge with SC27XX
>  	 PMIC chips.
>  
> +config CHARGER_UCS1002
> +        tristate "Microchip UCS1002 USB Port Power Controller"
> +	depends on I2C
> +	depends on OF
> +	select REGMAP_I2C
> +	help
> +	  Say Y to enable support for Microchip UCS1002 Programmable
> +	  USB Port Power Controller with Charger Emulation.
> +
>  endif # POWER_SUPPLY
> diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
> index b731c2a9b695..c56803a9e4fe 100644
> --- a/drivers/power/supply/Makefile
> +++ b/drivers/power/supply/Makefile
> @@ -87,3 +87,4 @@ obj-$(CONFIG_AXP288_CHARGER)	+= axp288_charger.o
>  obj-$(CONFIG_CHARGER_CROS_USBPD)	+= cros_usbpd-charger.o
>  obj-$(CONFIG_CHARGER_SC2731)	+= sc2731_charger.o
>  obj-$(CONFIG_FUEL_GAUGE_SC27XX)	+= sc27xx_fuel_gauge.o
> +obj-$(CONFIG_CHARGER_UCS1002)	+= ucs1002_power.o
> diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c
> new file mode 100644
> index 000000000000..677f20a4d76f
> --- /dev/null
> +++ b/drivers/power/supply/ucs1002_power.c
> @@ -0,0 +1,646 @@
...
> +
> +static enum power_supply_usb_type ucs1002_usb_types[] = {
> +	POWER_SUPPLY_USB_TYPE_PD,
> +	POWER_SUPPLY_USB_TYPE_SDP,
> +	POWER_SUPPLY_USB_TYPE_DCP,
> +	POWER_SUPPLY_USB_TYPE_CDP,
> +	POWER_SUPPLY_USB_TYPE_UNKNOWN,
> +};
> +
> +static int ucs1002_set_usb_type(struct ucs1002_info *info, int val)
> +{
> +	unsigned int mode;
> +
> +	if (val >= ARRAY_SIZE(ucs1002_usb_types))
> +		return -EINVAL;
> +
I hate to bring it up that late, but I don't see a check
against val being negative anywhere in the calling code.

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ