aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/adv7604.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/adv7604.c')
-rw-r--r--drivers/media/i2c/adv7604.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 31a63c9324fe..4cdcfc96aa56 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1968,7 +1968,7 @@ static int adv7604_probe(struct i2c_client *client,
1968 v4l_dbg(1, debug, client, "detecting adv7604 client on address 0x%x\n", 1968 v4l_dbg(1, debug, client, "detecting adv7604 client on address 0x%x\n",
1969 client->addr << 1); 1969 client->addr << 1);
1970 1970
1971 state = kzalloc(sizeof(struct adv7604_state), GFP_KERNEL); 1971 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
1972 if (!state) { 1972 if (!state) {
1973 v4l_err(client, "Could not allocate adv7604_state memory!\n"); 1973 v4l_err(client, "Could not allocate adv7604_state memory!\n");
1974 return -ENOMEM; 1974 return -ENOMEM;
@@ -1977,8 +1977,7 @@ static int adv7604_probe(struct i2c_client *client,
1977 /* platform data */ 1977 /* platform data */
1978 if (!pdata) { 1978 if (!pdata) {
1979 v4l_err(client, "No platform data!\n"); 1979 v4l_err(client, "No platform data!\n");
1980 err = -ENODEV; 1980 return -ENODEV;
1981 goto err_state;
1982 } 1981 }
1983 memcpy(&state->pdata, pdata, sizeof(state->pdata)); 1982 memcpy(&state->pdata, pdata, sizeof(state->pdata));
1984 1983
@@ -1991,8 +1990,7 @@ static int adv7604_probe(struct i2c_client *client,
1991 if (adv_smbus_read_byte_data_check(client, 0xfb, false) != 0x68) { 1990 if (adv_smbus_read_byte_data_check(client, 0xfb, false) != 0x68) {
1992 v4l2_info(sd, "not an adv7604 on address 0x%x\n", 1991 v4l2_info(sd, "not an adv7604 on address 0x%x\n",
1993 client->addr << 1); 1992 client->addr << 1);
1994 err = -ENODEV; 1993 return -ENODEV;
1995 goto err_state;
1996 } 1994 }
1997 1995
1998 /* control handlers */ 1996 /* control handlers */
@@ -2093,8 +2091,6 @@ err_i2c:
2093 adv7604_unregister_clients(state); 2091 adv7604_unregister_clients(state);
2094err_hdl: 2092err_hdl:
2095 v4l2_ctrl_handler_free(hdl); 2093 v4l2_ctrl_handler_free(hdl);
2096err_state:
2097 kfree(state);
2098 return err; 2094 return err;
2099} 2095}
2100 2096
@@ -2111,7 +2107,6 @@ static int adv7604_remove(struct i2c_client *client)
2111 media_entity_cleanup(&sd->entity); 2107 media_entity_cleanup(&sd->entity);
2112 adv7604_unregister_clients(to_state(sd)); 2108 adv7604_unregister_clients(to_state(sd));
2113 v4l2_ctrl_handler_free(sd->ctrl_handler); 2109 v4l2_ctrl_handler_free(sd->ctrl_handler);
2114 kfree(to_state(sd));
2115 return 0; 2110 return 0;
2116} 2111}
2117 2112