[PATCH][v1] driver/FSL SATA:Fix wrong Device Error Register usage

David Laight David.Laight at ACULAB.COM
Mon Feb 21 20:21:52 EST 2011


The patch changes the code to:

>  		if (ap->nr_pmp_links) {
> +			int dev_num;
>  			dereg = ioread32(hcr_base + DE);
...
> +			dev_num = ffs(dereg)-1;
> +			if (dev_num < ap->nr_pmp_links) {
> +				link = &ap->pmp_link[dev_num];

On the off chance that no bits are set in 'DE' this
code depends on nr_pmp_links being unsigned (since
dev_num becomes -1.

Changing 'dev_num' to 'unsigned int' would be better.

	David





More information about the Linuxppc-dev mailing list