Re: [RFC 3/8] snd-aoa: add soundbus

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

 



At Thu, 01 Jun 2006 13:58:47 +0200,
Johannes Berg wrote:
> 
> --- /dev/null
> +++ b/sound/aoa/soundbus/sysfs.c
> +static ssize_t
> +compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct of_device *of;
> +	char *compat;
> +	int cplen;
> +	int length = 0;
> +
> +	of = &to_soundbus_device (dev)->ofdev;
> +	compat = (char *) get_property(of->node, "compatible", &cplen);
> +	if (!compat) {
> +		*buf = '\0';
> +		return 0;
> +	}
> +	while (cplen > 0) {
> +		int l;
> +		length += sprintf (buf, "%s\n", compat);
> +		buf += length;

This seems wrong.  The above should be

	l = sprintf(buf + length, "%s\n", compat);
	length += l;
	buf += l;

> +		l = strlen (compat) + 1;
> +		compat += l;
> +		cplen -= l;
> +	}
> +
> +	return length;
> +}
> +
> +static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
> +			      char *buf)
> +{
> +	struct soundbus_dev *sdev = to_soundbus_device(dev);
> +	struct of_device *of = &sdev->ofdev;
> +	int length;
> +
> +	if (strlen(sdev->modalias)) {
> +		length = snprintf (buf, 34, "%s\n", sdev->modalias);

sizeof(sdev->modalias) + 2?  But still strange if modalias has no
nul-end.

> +	} else {
> +		length = sprintf (buf, "of:N%sT%s\n", of->node->name, of->node->type);
> +	}

Remove braces for single-line if (and too long).


Takashi


_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux