@@ -899,7 +899,7 @@ static int cal_camerarx_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
goto out_unlock;
if (remote_desc.type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) {
- dev_err(phy->cal->dev,
+ cal_err(phy->cal,
"Frame descriptor does not describe CSI-2 link");
ret = -EINVAL;
goto out_unlock;
@@ -911,6 +911,8 @@ static int cal_camerarx_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
}
if (i == remote_desc.num_entries) {
+ cal_err(phy->cal, "Stream %u not found in remote frame desc\n",
+ sink_stream);
ret = -EINVAL;
goto out_unlock;
}
@@ -960,7 +962,7 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
unsigned int i;
int ret;
- phy = kzalloc(sizeof(*phy), GFP_KERNEL);
+ phy = devm_kzalloc(cal->dev, sizeof(*phy), GFP_KERNEL);
if (!phy)
return ERR_PTR(-ENOMEM);
@@ -976,8 +978,7 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
phy->base = devm_ioremap_resource(cal->dev, phy->res);
if (IS_ERR(phy->base)) {
cal_err(cal, "failed to ioremap\n");
- ret = PTR_ERR(phy->base);
- goto err_entity_cleanup;
+ return ERR_CAST(phy->base);
}
cal_dbg(1, cal, "ioresource %s at %pa - %pa\n",
@@ -985,11 +986,11 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
ret = cal_camerarx_regmap_init(cal, phy);
if (ret)
- goto err_entity_cleanup;
+ return ERR_PTR(ret);
ret = cal_camerarx_parse_dt(phy);
if (ret)
- goto err_entity_cleanup;
+ return ERR_PTR(ret);
/* Initialize the V4L2 subdev and media entity. */
sd = &phy->subdev;
@@ -1006,7 +1007,7 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(phy->pads),
phy->pads);
if (ret)
- goto err_entity_cleanup;
+ goto err_node_put;
ret = v4l2_subdev_init_finalize(sd);
if (ret)
@@ -1022,7 +1023,9 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
v4l2_subdev_cleanup(sd);
err_entity_cleanup:
media_entity_cleanup(&phy->subdev.entity);
- kfree(phy);
+err_node_put:
+ of_node_put(phy->source_ep_node);
+ of_node_put(phy->source_node);
return ERR_PTR(ret);
}
@@ -1036,5 +1039,4 @@ void cal_camerarx_destroy(struct cal_camerarx *phy)
media_entity_cleanup(&phy->subdev.entity);
of_node_put(phy->source_ep_node);
of_node_put(phy->source_node);
- kfree(phy);
}
@@ -76,7 +76,7 @@ const struct cal_format_info cal_formats[] = {
.code = MEDIA_BUS_FMT_VYUY8_1X16,
.bpp = 16,
}, {
- .fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */
+ .fourcc = V4L2_PIX_FMT_RGB565,
.code = MEDIA_BUS_FMT_RGB565_1X16,
.bpp = 16,
}, {