fixup! media: synopsys: add driver for the designware mipi csi-2 receiver

Michael Riesch posted 1 patch 2 weeks, 3 days ago
drivers/media/platform/synopsys/dw-mipi-csi2rx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
fixup! media: synopsys: add driver for the designware mipi csi-2 receiver
Posted by Michael Riesch 2 weeks, 3 days ago
Make smatch happy by adding braces around the initialization in switch
cases.

Signed-off-by: Michael Riesch <michael.riesch@collabora.com>
---
@Sakari could you try the following patch? I think this should solve the
issues with smatch/sparse you mentioned off-list.

 drivers/media/platform/synopsys/dw-mipi-csi2rx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
index 29119a1a8d38..dc82223e312a 100644
--- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
+++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
@@ -236,7 +236,7 @@ static int dw_mipi_csi2rx_start(struct
dw_mipi_csi2rx_device *csi2)
                return link_freq;

        switch (csi2->bus_type) {
-       case V4L2_MBUS_CSI2_DPHY:
+       case V4L2_MBUS_CSI2_DPHY: {
                struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy;

                ret =
phy_mipi_dphy_get_default_config_for_hsclk(link_freq * 2,
@@ -254,7 +254,7 @@ static int dw_mipi_csi2rx_start(struct
dw_mipi_csi2rx_device *csi2)

                control |= SW_CPHY_EN(0);
                break;
-
+       }
        case V4L2_MBUS_CSI2_CPHY:
                /* TODO: implement CPHY configuration */
                return -EOPNOTSUPP;
@@ -293,7 +293,7 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,
        struct dw_mipi_csi2rx_device *csi2 = to_csi2(sd);

        switch (code->pad) {
-       case DW_MIPI_CSI2RX_PAD_SRC:
+       case DW_MIPI_CSI2RX_PAD_SRC: {
                const struct v4l2_mbus_framefmt *sink_fmt;

                if (code->index)
@@ -304,6 +304,7 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,
                code->code = sink_fmt->code;

                return 0;
+       }
        case DW_MIPI_CSI2RX_PAD_SINK:
                if (code->index > csi2->formats_num)
                        return -EINVAL;

-- 
2.39.5
Re: fixup! media: synopsys: add driver for the designware mipi csi-2 receiver
Posted by Sakari Ailus 2 weeks, 3 days ago
Hi Michael,

On Tue, Jan 20, 2026 at 08:35:17PM +0100, Michael Riesch wrote:
> Make smatch happy by adding braces around the initialization in switch
> cases.
> 
> Signed-off-by: Michael Riesch <michael.riesch@collabora.com>
> ---
> @Sakari could you try the following patch? I think this should solve the
> issues with smatch/sparse you mentioned off-list.

I don't know what went wrong but this won't apply.

Instead I made the following changes:

diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
index 29119a1a8d38..170346ae1a59 100644
--- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
+++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
@@ -237,10 +237,8 @@ static int dw_mipi_csi2rx_start(struct dw_mipi_csi2rx_device *csi2)
 
 	switch (csi2->bus_type) {
 	case V4L2_MBUS_CSI2_DPHY:
-		struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy;
-
 		ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq * 2,
-								 lanes, cfg);
+								 lanes, &opts.mipi_dphy);
 		if (ret)
 			return ret;
 
@@ -294,14 +292,12 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,
 
 	switch (code->pad) {
 	case DW_MIPI_CSI2RX_PAD_SRC:
-		const struct v4l2_mbus_framefmt *sink_fmt;
-
 		if (code->index)
 			return -EINVAL;
 
-		sink_fmt = v4l2_subdev_state_get_format(
-			sd_state, DW_MIPI_CSI2RX_PAD_SINK);
-		code->code = sink_fmt->code;
+		code->code =
+			v4l2_subdev_state_get_format(sd_state,
+						     DW_MIPI_CSI2RX_PAD_SINK)->code;
 
 		return 0;
 	case DW_MIPI_CSI2RX_PAD_SINK:

-- 
Regards,

Sakari Ailus
Re: fixup! media: synopsys: add driver for the designware mipi csi-2 receiver
Posted by Michael Riesch 2 weeks, 3 days ago
Hi Sakari,

On 1/21/26 00:05, Sakari Ailus wrote:
> Hi Michael,
> 
> On Tue, Jan 20, 2026 at 08:35:17PM +0100, Michael Riesch wrote:
>> Make smatch happy by adding braces around the initialization in switch
>> cases.
>>
>> Signed-off-by: Michael Riesch <michael.riesch@collabora.com>
>> ---
>> @Sakari could you try the following patch? I think this should solve the
>> issues with smatch/sparse you mentioned off-list.
> 
> I don't know what went wrong but this won't apply.
> 
> Instead I made the following changes:

Yep, these are fine. Thank you very much for doing the fixup!

Best regards,
Michael

> 
> diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> index 29119a1a8d38..170346ae1a59 100644
> --- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> +++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
> @@ -237,10 +237,8 @@ static int dw_mipi_csi2rx_start(struct dw_mipi_csi2rx_device *csi2)
>  
>  	switch (csi2->bus_type) {
>  	case V4L2_MBUS_CSI2_DPHY:
> -		struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy;
> -
>  		ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq * 2,
> -								 lanes, cfg);
> +								 lanes, &opts.mipi_dphy);
>  		if (ret)
>  			return ret;
>  
> @@ -294,14 +292,12 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,
>  
>  	switch (code->pad) {
>  	case DW_MIPI_CSI2RX_PAD_SRC:
> -		const struct v4l2_mbus_framefmt *sink_fmt;
> -
>  		if (code->index)
>  			return -EINVAL;
>  
> -		sink_fmt = v4l2_subdev_state_get_format(
> -			sd_state, DW_MIPI_CSI2RX_PAD_SINK);
> -		code->code = sink_fmt->code;
> +		code->code =
> +			v4l2_subdev_state_get_format(sd_state,
> +						     DW_MIPI_CSI2RX_PAD_SINK)->code;
>  
>  		return 0;
>  	case DW_MIPI_CSI2RX_PAD_SINK:
>