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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOMZO5BarpUGOExmDR8c2e0YOL41MmNkMii2ZU+jKrmEVtcmig@mail.gmail.com>
Date:	Wed, 6 Nov 2013 21:09:32 -0200
From:	Fabio Estevam <festevam@...il.com>
To:	Alan Tull <delicious.quinoa@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-gpio@...r.kernel.org,
	Linus Walleij <linus.walleij@...ricsson.com>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	Rob Herring <rob.herring@...xeda.com>,
	Steffen Trumtrar <s.trumtrar@...gutronix.de>,
	Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
	Jamie Iles <jamie@...ieiles.com>,
	Heiko Stuebner <heiko@...ech.de>, Alan Tull <atull@...era.com>,
	Dinh Nguyen <dinguyen@...era.com>,
	Yves Vandervennet <rocket.yvanderv@...il.com>
Subject: Re: [PATCH 1/1] gpio: add a driver for the Synopsys DesignWare APB
 GPIO block

On Wed, Nov 6, 2013 at 8:49 PM, Alan Tull <delicious.quinoa@...il.com> wrote:

> +
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       gpio->regs = devm_ioremap_resource(&pdev->dev, res);
> +       if (!gpio->regs) {
> +               err = -ENOMEM;
> +               goto out_free_ports;

The correct way to handle the error here would be:

if (IS_ERR(gpio->regs) {
     err = PTR_ERR(gpio->regs)
     goto out_free_ports;


> +out_unregister:
> +       dwapb_gpio_unregister(gpio);
> +
> +       if (gpio->domain) {
> +               irq_dispose_mapping(gpio->hwirq);
> +               irq_domain_remove(gpio->domain);
> +       }
> +
> +out_free_ports:
> +       devm_kfree(&pdev->dev, gpio->ports);

No need to call devm_kfree

> +
> +out_err:
> +       devm_kfree(&pdev->dev, gpio);

Same here.

> +       return err;
> +}
> +
> +static int dwapb_gpio_remove(struct platform_device *pdev)
> +{
> +       struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
> +
> +       dwapb_gpio_unregister(gpio);
> +       if (gpio->domain) {
> +               irq_dispose_mapping(gpio->hwirq);
> +               irq_domain_remove(gpio->domain);
> +       }
> +       devm_kfree(&pdev->dev, gpio->ports);
> +       devm_kfree(&pdev->dev, gpio);

No need to call devm_kfree

Regards,

Fabio Estevam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ