aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-10-24 18:16:58 +0200
committerJean Delvare <khali@endymion.delvare>2010-10-24 18:16:58 +0200
commit9cb2c2726e9ae212ccaeecd3eaadcd8d49ac7400 (patch)
treefb551cce7de62fc65c38beef7b014bb405362f61 /drivers/i2c/i2c-core.c
parentef9d9b8fb696850a95cd59ba2cd67991b6f722b3 (diff)
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/) // <smpl> @exists@ identifier f; constant C; @@ unsigned f(...) { <+... * return -C; ...+> } // </smpl> 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: // <smpl> @@ @@ + status = amd_ec_write - amd_ec_write (...); + if (status) return status; @@ @@ + status = amd_ec_read - amd_ec_read (...); + if (status) return status; // </smpl> The patch also adds the declaration of the status variable. Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
0 files changed, 0 insertions, 0 deletions