aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2021-04-24 07:54:43 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-10 11:16:10 +0200
commitd2d9b94164862f06207b60310ae3854f5f0058ad (patch)
tree7fadd8c7f5969174c5a18973b8f96c82b920aabc /drivers/usb/gadget
parentusb: gadget: function: fix typo in f_hid.c (diff)
downloadlinux-dev-d2d9b94164862f06207b60310ae3854f5f0058ad.tar.xz
linux-dev-d2d9b94164862f06207b60310ae3854f5f0058ad.zip
usb: gadget: Drop unnecessary NULL checks after container_of
The parameters passed to allow_link and drop_link functions are never NULL. That means the result of container_of() on those parameters is also never NULL, even though the reference into the structure points to the first element of the structure. Remove the unnecessary NULL checks. This change was made automatically with the following Coccinelle script. A now obsolete 'out:' label was removed manually. @@ type t; identifier v; statement s; @@ <+... ( t v = container_of(...); | v = container_of(...); ) ... when != v - if (\( !v \| v == NULL \) ) s ...+> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Felipe Balbi <balbi@kernel.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210424145443.170413-1-linux@roeck-us.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/function/uvc_configfs.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index cd28dec837dd..77d64031aa9c 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -914,8 +914,6 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
target_fmt = container_of(to_config_group(target), struct uvcg_format,
group);
- if (!target_fmt)
- goto out;
uvcg_format_set_indices(to_config_group(target));
@@ -955,8 +953,6 @@ static void uvcg_streaming_header_drop_link(struct config_item *src,
mutex_lock(&opts->lock);
target_fmt = container_of(to_config_group(target), struct uvcg_format,
group);
- if (!target_fmt)
- goto out;
list_for_each_entry_safe(format_ptr, tmp, &src_hdr->formats, entry)
if (format_ptr->fmt == target_fmt) {
@@ -968,7 +964,6 @@ static void uvcg_streaming_header_drop_link(struct config_item *src,
--target_fmt->linked;
-out:
mutex_unlock(&opts->lock);
mutex_unlock(su_mutex);
}