Re: [PATCH 2/2] ASoC: Add headset jack detection for SDP3430 machine driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 04, 2009 at 11:39:12AM -0600, Lopez Cruz, Misael wrote:

> +/* Headset jack */
> +struct snd_soc_jack *hs_jack;

This (and all your other globals) should be declared static.

> +/* Headset jack DAPM pins */
> +struct snd_soc_jack_pin hs_jack_pins[] = {
> +	{
> +		.pin = "Headset Jack",
> +		.mask = SND_JACK_HEADSET,
> +		.invert = 0,
> +	},
> +};

No need to initialise things to zero, that's the default for static
variables.

> +	/* Headset jack detection */
> +	hs_jack = kzalloc(sizeof(struct snd_soc_jack), GFP_KERNEL);
> +	if (!hs_jack)
> +		return -ENOMEM;

If you declare hs_jack as a direct static variable you won't need to
kzalloc() it and save some error checking and cleanup code too :)

> +	ret = snd_soc_jack_new(&snd_soc_sdp3430, "SDP3430 headset jack",
> +				SND_JACK_HEADSET, hs_jack);
> +	if (ret)
> +		return ret;

This leaks the jack.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux