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]
Message-Id: <20080715131004.32646dae.sfr@canb.auug.org.au>
Date:	Tue, 15 Jul 2008 13:10:04 +1000
From:	Stephen Rothwell <sfr@...b.auug.org.au>
To:	Anton Vorontsov <avorontsov@...mvista.com>
Cc:	Richard Purdie <rpurdie@...ys.net>, linuxppc-dev@...abs.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: implement OpenFirmare GPIO LED driver

Hi Anton,

On Mon, 14 Jul 2008 20:41:14 +0400 Anton Vorontsov <avorontsov@...mvista.com> wrote:
>
> +static int __devinit of_gpio_leds_probe(struct of_device *ofdev,
> +					const struct of_device_id *match)
> +{
> +	int ret;
> +	struct of_gpio_led *led;
> +	struct device_node *np = ofdev->node;
> +
> +	led = kzalloc(sizeof(*led), GFP_KERNEL);
> +	if (!led)
> +		return -ENOMEM;
> +
> +	led->np = np;

You need to take a reference if you are keeping a pointer to a
device_node, so:
	led->np = of_node_get(np);

> +	led->cdev.name = of_get_property(np, "label", NULL);
> +	if (!led->cdev.name)
> +		led->cdev.name = ofdev->dev.bus_id;

Please use dev_name() in new code:
		led->cdev.name = dev_name(&ofdev->dev);

> +	led->cdev.brightness_set = gpio_led_set;
> +
> +	ret = gpio_request(led->gpio, ofdev->dev.bus_id);

dev_name() again.

> +err_get_gpio:

	of_node_put(led->np);

> +	kfree(led);
> +	return ret;
> +}
> +
> +static int __devexit of_gpio_leds_remove(struct of_device *ofdev)
> +{
> +	struct of_gpio_led *led = dev_get_drvdata(&ofdev->dev);
> +
> +	led_classdev_unregister(&led->cdev);
> +	cancel_work_sync(&led->work);
> +	gpio_free(led->gpio);
> +	of_node_put(led->np);

This was going to be unbalanced, but is now correct.

-- 
Cheers,
Stephen Rothwell                    sfr@...b.auug.org.au
http://www.canb.auug.org.au/~sfr/

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ