diff mbox series

media: bcm2835-unicam: Fix a NULL vs IS_ERR() check

Message ID fbbe7862-2820-44eb-81cb-7f33b99cca35@moroto.mountain (mailing list archive)
State New
Headers show
Series media: bcm2835-unicam: Fix a NULL vs IS_ERR() check | expand

Commit Message

Dan Carpenter May 8, 2024, 12:31 p.m. UTC
The media_pad_remote_pad_unique() function returns error pointers, not
NULL.  Update the check accordingly.

Fixes: 392cd78d495f ("media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/media/platform/broadcom/bcm2835-unicam.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart May 8, 2024, 3:11 p.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Wed, May 08, 2024 at 03:31:00PM +0300, Dan Carpenter wrote:
> The media_pad_remote_pad_unique() function returns error pointers, not
> NULL.  Update the check accordingly.
> 
> Fixes: 392cd78d495f ("media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/broadcom/bcm2835-unicam.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
> index 3c7878d8d79b..ad55fc930e5b 100644
> --- a/drivers/media/platform/broadcom/bcm2835-unicam.c
> +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
> @@ -2433,9 +2433,9 @@ static int unicam_async_bound(struct v4l2_async_notifier *notifier,
>  		return ret;
>  
>  	source = media_pad_remote_pad_unique(sink);
> -	if (!source) {
> +	if (IS_ERR(source)) {
>  		dev_err(unicam->dev, "No connected sensor pad\n");
> -		return -ENOTCONN;
> +		return PTR_ERR(source);
>  	}
>  
>  	unicam->sensor.subdev = subdev;
diff mbox series

Patch

diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index 3c7878d8d79b..ad55fc930e5b 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -2433,9 +2433,9 @@  static int unicam_async_bound(struct v4l2_async_notifier *notifier,
 		return ret;
 
 	source = media_pad_remote_pad_unique(sink);
-	if (!source) {
+	if (IS_ERR(source)) {
 		dev_err(unicam->dev, "No connected sensor pad\n");
-		return -ENOTCONN;
+		return PTR_ERR(source);
 	}
 
 	unicam->sensor.subdev = subdev;