summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-12-04 15:39:43 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-12-13 15:21:20 +0300
commit4024107e104c06ac497b87bfd063c377b0b74527 (patch)
treeb612aae23c2b96c5f6bc0910fefe74ba6015ec1d /drivers/media
parent3735228bbe3511f844e03dfcc4003fadb59dde23 (diff)
downloadlinux-4024107e104c06ac497b87bfd063c377b0b74527.tar.xz
media: ov2740: Check hwcfg after allocating the ov2740 struct
Alloc ov2740_data and set up the drvdata pointer before calling ov2740_check_hwcfg(). This is a preparation patch to allow ov2740_check_hwcfg() to store some of the parsed data in the ov2740 struct. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/ov2740.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index 759e91f4169b..54e6f62414ff 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -1098,14 +1098,17 @@ static int ov2740_probe(struct i2c_client *client)
bool full_power;
int ret;
- ret = ov2740_check_hwcfg(&client->dev);
- if (ret)
- return dev_err_probe(dev, ret, "failed to check HW configuration\n");
-
ov2740 = devm_kzalloc(&client->dev, sizeof(*ov2740), GFP_KERNEL);
if (!ov2740)
return -ENOMEM;
+ v4l2_i2c_subdev_init(&ov2740->sd, client, &ov2740_subdev_ops);
+ ov2740->sd.internal_ops = &ov2740_internal_ops;
+
+ ret = ov2740_check_hwcfg(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to check HW configuration\n");
+
ov2740->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(ov2740->reset_gpio))
return dev_err_probe(dev, PTR_ERR(ov2740->reset_gpio),
@@ -1116,8 +1119,6 @@ static int ov2740_probe(struct i2c_client *client)
return dev_err_probe(dev, PTR_ERR(ov2740->clk),
"failed to get clock\n");
- v4l2_i2c_subdev_init(&ov2740->sd, client, &ov2740_subdev_ops);
- ov2740->sd.internal_ops = &ov2740_internal_ops;
full_power = acpi_dev_state_d0(&client->dev);
if (full_power) {
/* ACPI does not always clear the reset GPIO / enable the clock */