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:	Wed, 29 Jun 2016 16:13:38 +0530
From:	Manish Badarkhe <badarkhe.manish@...il.com>
To:	Keerthy <j-keerthy@...com>
Cc:	linus.walleij@...aro.org, gnurou@...il.com,
	Lee Jones <lee.jones@...aro.org>, linux-omap@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	linux-gpio@...r.kernel.org, Mark Brown <broonie@...nel.org>,
	robh+dt@...nel.org, Tony Lindgren <tony@...mide.com>
Subject: Re: [PATCH v4 3/3] gpio: lp873x: Add support for General Purpose Outputs

Hi Keerthy

Some minor comment

> +static int lp873x_gpio_direction_output(struct gpio_chip *chip,
> +                                       unsigned int offset, int value)
> +{
> +       struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> +
> +       /* Set the initial value */
> +       regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL,
> +                          BIT(offset * 4), value ? BIT(offset * 4) : 0);
> +
> +       return 0;
> +}

Error needs to be return, this function always return 0.

> +
> +static int lp873x_gpio_get(struct gpio_chip *chip, unsigned int offset)
> +{
> +       struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> +       int ret, val;
> +
> +       ret = regmap_read(gpio->lp873->regmap, LP873X_REG_GPO_CTRL, &val);
> +       if (ret < 0)
> +               return ret;
> +
> +       return val & BIT(offset * 4);
> +}
> +
> +static void lp873x_gpio_set(struct gpio_chip *chip, unsigned int offset,
> +                           int value)
> +{
> +       struct lp873x_gpio *gpio = gpiochip_get_data(chip);
> +
> +       regmap_update_bits(gpio->lp873->regmap, LP873X_REG_GPO_CTRL,
> +                          BIT(offset * 4), value ? BIT(offset * 4) : 0);
> +}
> +
> +static int lp873x_gpio_request(struct gpio_chip *gc, unsigned int offset)
> +{
> +       struct lp873x_gpio *gpio = gpiochip_get_data(gc);
> +       int ret;
> +
> +       switch (offset) {
> +       case 0:
> +               /* No MUX Set up Needed for GPO */
> +               break;
> +       case 1:
> +               /* Setup the CLKIN_PIN_SEL MUX to GPO2 */
> +               ret = regmap_update_bits(gpio->lp873->regmap, LP873X_REG_CONFIG,
> +                                        LP873X_CONFIG_CLKIN_PIN_SEL, 0);
> +               if (ret)
> +                       return ret;
> +
> +               break;
> +       default:
> +               return -EINVAL;
> +       }
> +
> +       return 0;
> +}

Error needs to be return, this function always return 0. Only default
returns error here which is unlikely condition.

> +
> +
> +static int lp873x_gpio_set_single_ended(struct gpio_chip *gc,
> +                                       unsigned int offset,
> +                                       enum single_ended_mode mode)
> +{
> +       struct lp873x_gpio *gpio = gpiochip_get_data(gc);
> +
> +       switch (mode) {
> +       case LINE_MODE_OPEN_DRAIN:
> +               return regmap_update_bits(gpio->lp873->regmap,
> +                                         LP873X_REG_GPO_CTRL,
> +                                         BIT(offset * 4 + 2),
> +                                         BIT(offset * 4 + 2));
> +       case LINE_MODE_PUSH_PULL:
> +               return regmap_update_bits(gpio->lp873->regmap,
> +                                         LP873X_REG_GPO_CTRL,
> +                                         BIT(offset * 4 + 2), 0);
> +       default:
> +               return -ENOTSUPP;
> +       }
> +}

Error needs to be return, this function always return 0. Only default
returns error here which is unlikely condition.

Regards
Manish Badarkhe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ