From: Julia Lawall Date: Sun, 24 Oct 2010 16:16:58 +0000 (+0200) Subject: i2c-amd8111: Add proper error handling X-Git-Tag: v2.6.37-rc1~143^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cb2c2726e9ae212ccaeecd3eaadcd8d49ac7400;p=pandora-kernel.git i2c-amd8111: Add proper error handling The functions the functions amd_ec_wait_write and amd_ec_wait_read have an unsigned return type, but return a negative constant to indicate an error condition. A sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @exists@ identifier f; constant C; @@ unsigned f(...) { <+... * return -C; ...+> } // Fixing amd_ec_wait_write and amd_ec_wait_read leads to the need to adjust the return type of the functions amd_ec_write and amd_ec_read, which are the only functions that call amd_ec_wait_write and amd_ec_wait_read. amd_ec_write and amd_ec_read, in turn, are only called from within the function amd8111_access, which already returns a signed typed value. Each of the calls to amd_ec_write and amd_ec_read are updated using the following semantic patch: // @@ @@ + status = amd_ec_write - amd_ec_write (...); + if (status) return status; @@ @@ + status = amd_ec_read - amd_ec_read (...); + if (status) return status; // The patch also adds the declaration of the status variable. Signed-off-by: Julia Lawall Signed-off-by: Jean Delvare --- Reading git-diff-tree failed