Re: [PATCH v2] media: ipu-bridge: fix error code in ipu_bridge_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Fri, May 10, 2024 at 06:43:31PM +0300, Dan Carpenter wrote:
> Return -EINVAL if "bridge->n_sensors == 0".  Don't return success.
> 
> Fixes: 881ca25978c6 ("media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> v2: style change
> 
>  drivers/media/pci/intel/ipu-bridge.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
> index 61750cc98d70..44a9d9c15b05 100644
> --- a/drivers/media/pci/intel/ipu-bridge.c
> +++ b/drivers/media/pci/intel/ipu-bridge.c
> @@ -839,9 +839,14 @@ int ipu_bridge_init(struct device *dev,
>  		bridge->data_lanes[i] = i + 1;
>  
>  	ret = ipu_bridge_connect_sensors(bridge);
> -	if (ret || bridge->n_sensors == 0)
> +	if (ret)
>  		goto err_unregister_ipu;
>  
> +	if (bridge->n_sensors == 0) {
> +		ret = -EINVAL;
> +		goto err_unregister_ipu;
> +	}

This would return an error if there are no sensors.

Neither IPU3-CIO2 or IPU6 ISYS drivers should be of any functional use
without sensors. But the power states of the devices could be affected by
this: the drivers should power off these devices but without drivers they
maybe left powered on. I haven't made any measurements though.

> +
>  	dev_info(dev, "Connected %d cameras\n", bridge->n_sensors);
>  
>  	fwnode = software_node_fwnode(&bridge->ipu_hid_node);

-- 
Kind regards,

Sakari Ailus




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux