Re: [PATCH v5 01/12] media: rcar-vin: Use correct count of remote subdevices

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

 



Hejssan,

On Fri, Jun 06, 2025 at 08:25:55PM +0200, Niklas Söderlund wrote:
> When extending the driver with Gen4 support the iteration of over
> possible remote subdevices changed from being R-Car CSI-2 Rx only to
> also cover R-Car CSISP instances. In two loops updating the bounds
> variable was missed.
> 
> This had no ill effect as the count the two values have always been the
> same in the past. Fix it by looking at the array size.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
> Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@xxxxxxxxxxxxxxxx>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
> ---
> * Changes since v4
> - Use ARRAY_SIZE() instead of updating the incorrect define to
>   RVIN_REMOTES_MAX.

Do you still need RVIN_REMOTES_MAX()? Couldn't you use ARRAY_SIZE()
elsewhere, too?

> ---
>  drivers/media/platform/renesas/rcar-vin/rcar-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
> index 846ae7989b1d..cf5830d7d7b1 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
> @@ -213,7 +213,7 @@ static int rvin_group_entity_to_remote_id(struct rvin_group *group,
>  
>  	sd = media_entity_to_v4l2_subdev(entity);
>  
> -	for (i = 0; i < RVIN_REMOTES_MAX; i++)
> +	for (i = 0; i < ARRAY_SIZE(group->remotes); i++)
>  		if (group->remotes[i].subdev == sd)
>  			return i;
>  
> @@ -262,7 +262,7 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
>  
>  	mutex_lock(&vin->group->lock);
>  
> -	for (i = 0; i < RVIN_CSI_MAX; i++) {
> +	for (i = 0; i < ARRAY_SIZE(vin->group->remotes); i++) {
>  		if (vin->group->remotes[i].asc != asc)
>  			continue;
>  		vin->group->remotes[i].subdev = NULL;
> @@ -284,7 +284,7 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
>  
>  	mutex_lock(&vin->group->lock);
>  
> -	for (i = 0; i < RVIN_CSI_MAX; i++) {
> +	for (i = 0; i < ARRAY_SIZE(vin->group->remotes); i++) {
>  		if (vin->group->remotes[i].asc != asc)
>  			continue;
>  		vin->group->remotes[i].subdev = subdev;

-- 
Kind regards,

Sakari Ailus




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux