All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/6] usb: gadget: uvc: fix some error codes
@ 2015-01-14 20:59 Dan Carpenter
  2015-01-16 11:18 ` Andrzej Pietrasiewicz
  2015-01-18 23:52 ` Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-01-14 20:59 UTC (permalink / raw)
  To: kernel-janitors

We're basically saying ERR_CAST(NULL) and PTR_ERR(NULL) here, which is
nonsensical.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 33d92ab..d112c99 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -148,7 +148,7 @@ static struct config_item *uvcg_control_header_make(struct config_group *group,
 
 	h = kzalloc(sizeof(*h), GFP_KERNEL);
 	if (!h)
-		return ERR_CAST(h);
+		return ERR_PTR(-ENOMEM);
 
 	h->desc.bLength			= UVC_DT_HEADER_SIZE(1);
 	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
@@ -840,7 +840,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
 
 	format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
 	if (!format_ptr) {
-		ret = PTR_ERR(format_ptr);
+		ret = -ENOMEM;
 		goto out;
 	}
 	ret = 0;
@@ -960,7 +960,7 @@ static struct config_item
 
 	h = kzalloc(sizeof(*h), GFP_KERNEL);
 	if (!h)
-		return ERR_CAST(h);
+		return ERR_PTR(-ENOMEM);
 
 	INIT_LIST_HEAD(&h->formats);
 	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
@@ -1278,7 +1278,7 @@ static struct config_item *uvcg_frame_make(struct config_group *group,
 
 	h = kzalloc(sizeof(*h), GFP_KERNEL);
 	if (!h)
-		return ERR_CAST(h);
+		return ERR_PTR(-ENOMEM);
 
 	h->frame.b_descriptor_type		= USB_DT_CS_INTERFACE;
 	h->frame.b_frame_index			= 1;
@@ -1563,7 +1563,7 @@ static struct config_group *uvcg_uncompressed_make(struct config_group *group,
 
 	h = kzalloc(sizeof(*h), GFP_KERNEL);
 	if (!h)
-		return ERR_CAST(h);
+		return ERR_PTR(-ENOMEM);
 
 	h->desc.bLength			= UVC_DT_FORMAT_UNCOMPRESSED_SIZE;
 	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
@@ -1772,7 +1772,7 @@ static struct config_group *uvcg_mjpeg_make(struct config_group *group,
 
 	h = kzalloc(sizeof(*h), GFP_KERNEL);
 	if (!h)
-		return ERR_CAST(h);
+		return ERR_PTR(-ENOMEM);
 
 	h->desc.bLength			= UVC_DT_FORMAT_MJPEG_SIZE;
 	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
@@ -2124,7 +2124,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
 	count += 2; /* color_matching, NULL */
 	*class_array = kcalloc(count, sizeof(void *), GFP_KERNEL);
 	if (!*class_array) {
-		ret = PTR_ERR(*class_array);
+		ret = -ENOMEM;
 		goto unlock;
 	}
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch 1/6] usb: gadget: uvc: fix some error codes
  2015-01-14 20:59 [patch 1/6] usb: gadget: uvc: fix some error codes Dan Carpenter
@ 2015-01-16 11:18 ` Andrzej Pietrasiewicz
  2015-01-18 23:52 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Andrzej Pietrasiewicz @ 2015-01-16 11:18 UTC (permalink / raw)
  To: kernel-janitors

W dniu 14.01.2015 o 21:59, Dan Carpenter pisze:
> We're basically saying ERR_CAST(NULL) and PTR_ERR(NULL) here, which is
> nonsensical.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>

>
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
> index 33d92ab..d112c99 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -148,7 +148,7 @@ static struct config_item *uvcg_control_header_make(struct config_group *group,
>
>   	h = kzalloc(sizeof(*h), GFP_KERNEL);
>   	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
>
>   	h->desc.bLength			= UVC_DT_HEADER_SIZE(1);
>   	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -840,7 +840,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
>
>   	format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
>   	if (!format_ptr) {
> -		ret = PTR_ERR(format_ptr);
> +		ret = -ENOMEM;
>   		goto out;
>   	}
>   	ret = 0;
> @@ -960,7 +960,7 @@ static struct config_item
>
>   	h = kzalloc(sizeof(*h), GFP_KERNEL);
>   	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
>
>   	INIT_LIST_HEAD(&h->formats);
>   	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -1278,7 +1278,7 @@ static struct config_item *uvcg_frame_make(struct config_group *group,
>
>   	h = kzalloc(sizeof(*h), GFP_KERNEL);
>   	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
>
>   	h->frame.b_descriptor_type		= USB_DT_CS_INTERFACE;
>   	h->frame.b_frame_index			= 1;
> @@ -1563,7 +1563,7 @@ static struct config_group *uvcg_uncompressed_make(struct config_group *group,
>
>   	h = kzalloc(sizeof(*h), GFP_KERNEL);
>   	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
>
>   	h->desc.bLength			= UVC_DT_FORMAT_UNCOMPRESSED_SIZE;
>   	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -1772,7 +1772,7 @@ static struct config_group *uvcg_mjpeg_make(struct config_group *group,
>
>   	h = kzalloc(sizeof(*h), GFP_KERNEL);
>   	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
>
>   	h->desc.bLength			= UVC_DT_FORMAT_MJPEG_SIZE;
>   	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -2124,7 +2124,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
>   	count += 2; /* color_matching, NULL */
>   	*class_array = kcalloc(count, sizeof(void *), GFP_KERNEL);
>   	if (!*class_array) {
> -		ret = PTR_ERR(*class_array);
> +		ret = -ENOMEM;
>   		goto unlock;
>   	}
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/6] usb: gadget: uvc: fix some error codes
  2015-01-14 20:59 [patch 1/6] usb: gadget: uvc: fix some error codes Dan Carpenter
  2015-01-16 11:18 ` Andrzej Pietrasiewicz
@ 2015-01-18 23:52 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2015-01-18 23:52 UTC (permalink / raw)
  To: kernel-janitors

Hi Dan,

Thank you for the patch.

On Wednesday 14 January 2015 23:59:48 Dan Carpenter wrote:
> We're basically saying ERR_CAST(NULL) and PTR_ERR(NULL) here, which is
> nonsensical.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

> diff --git a/drivers/usb/gadget/function/uvc_configfs.c
> b/drivers/usb/gadget/function/uvc_configfs.c index 33d92ab..d112c99 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -148,7 +148,7 @@ static struct config_item
> *uvcg_control_header_make(struct config_group *group,
> 
>  	h = kzalloc(sizeof(*h), GFP_KERNEL);
>  	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
> 
>  	h->desc.bLength			= UVC_DT_HEADER_SIZE(1);
>  	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -840,7 +840,7 @@ static int uvcg_streaming_header_allow_link(struct
> config_item *src,
> 
>  	format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
>  	if (!format_ptr) {
> -		ret = PTR_ERR(format_ptr);
> +		ret = -ENOMEM;
>  		goto out;
>  	}
>  	ret = 0;
> @@ -960,7 +960,7 @@ static struct config_item
> 
>  	h = kzalloc(sizeof(*h), GFP_KERNEL);
>  	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
> 
>  	INIT_LIST_HEAD(&h->formats);
>  	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -1278,7 +1278,7 @@ static struct config_item *uvcg_frame_make(struct
> config_group *group,
> 
>  	h = kzalloc(sizeof(*h), GFP_KERNEL);
>  	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
> 
>  	h->frame.b_descriptor_type		= USB_DT_CS_INTERFACE;
>  	h->frame.b_frame_index			= 1;
> @@ -1563,7 +1563,7 @@ static struct config_group
> *uvcg_uncompressed_make(struct config_group *group,
> 
>  	h = kzalloc(sizeof(*h), GFP_KERNEL);
>  	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
> 
>  	h->desc.bLength			= UVC_DT_FORMAT_UNCOMPRESSED_SIZE;
>  	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -1772,7 +1772,7 @@ static struct config_group *uvcg_mjpeg_make(struct
> config_group *group,
> 
>  	h = kzalloc(sizeof(*h), GFP_KERNEL);
>  	if (!h)
> -		return ERR_CAST(h);
> +		return ERR_PTR(-ENOMEM);
> 
>  	h->desc.bLength			= UVC_DT_FORMAT_MJPEG_SIZE;
>  	h->desc.bDescriptorType		= USB_DT_CS_INTERFACE;
> @@ -2124,7 +2124,7 @@ static int uvcg_streaming_class_allow_link(struct
> config_item *src, count += 2; /* color_matching, NULL */
>  	*class_array = kcalloc(count, sizeof(void *), GFP_KERNEL);
>  	if (!*class_array) {
> -		ret = PTR_ERR(*class_array);
> +		ret = -ENOMEM;
>  		goto unlock;
>  	}

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-18 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 20:59 [patch 1/6] usb: gadget: uvc: fix some error codes Dan Carpenter
2015-01-16 11:18 ` Andrzej Pietrasiewicz
2015-01-18 23:52 ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.