The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|
- (T*)
e
)
Signed-off-by: simran singhal <[email protected]>
---
drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
index ecf7721..125b5ff 100644
--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
+++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(ms_sensors_reset);
int ms_sensors_read_prom_word(void *cli, int cmd, u16 *word)
{
int ret;
- struct i2c_client *client = (struct i2c_client *)cli;
+ struct i2c_client *client = cli;
ret = i2c_smbus_read_word_swapped(client, cmd);
if (ret < 0) {
@@ -107,7 +107,7 @@ int ms_sensors_convert_and_read(void *cli, u8 conv, u8 rd,
{
int ret;
__be32 buf = 0;
- struct i2c_client *client = (struct i2c_client *)cli;
+ struct i2c_client *client = cli;
/* Trigger conversion */
ret = i2c_smbus_write_byte(client, conv);
--
2.7.4
On 01/04/17 15:09, simran singhal wrote:
> The following Coccinelle script was used to detect this:
> @r@
> expression x;
> void* e;
> type T;
> identifier f;
> @@
> (
> *((T *)e)
> |
> ((T *)x)[...]
> |
> ((T*)x)->f
> |
> - (T*)
> e
> )
>
> Signed-off-by: simran singhal <[email protected]>
Applied.
> ---
> drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
> index ecf7721..125b5ff 100644
> --- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
> +++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
> @@ -74,7 +74,7 @@ EXPORT_SYMBOL(ms_sensors_reset);
> int ms_sensors_read_prom_word(void *cli, int cmd, u16 *word)
> {
> int ret;
> - struct i2c_client *client = (struct i2c_client *)cli;
> + struct i2c_client *client = cli;
>
> ret = i2c_smbus_read_word_swapped(client, cmd);
> if (ret < 0) {
> @@ -107,7 +107,7 @@ int ms_sensors_convert_and_read(void *cli, u8 conv, u8 rd,
> {
> int ret;
> __be32 buf = 0;
> - struct i2c_client *client = (struct i2c_client *)cli;
> + struct i2c_client *client = cli;
>
> /* Trigger conversion */
> ret = i2c_smbus_write_byte(client, conv);
>