From nobody Wed Nov 27 19:47:49 2024 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A3D91F9A96 for ; Tue, 8 Oct 2024 07:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371182; cv=none; b=PlbPZNQZKSX48qp1L2m9yT+lhcrWReffz4Gbhri+D9AwK6xPNtGr7xXShTxFSwNj7c2EVsggeLqBKRBc+vcf/UZ0IXYpsmUtkgUqsZo26GDQBBx7X66dX14f0xtbL5x0iS/dyHBC7SdkuJhcXbxSvEOeajs0WzM05GScSU3Ug9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371182; c=relaxed/simple; bh=t1pAvWaDC2XezFxZD6bG6re3WWY632E7aLxyVqoDOEo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D61UT7ILkGWNHVsRGcDLuJw3wx9JeXqN4mj6GS4pdWRYl3HZPNeVjZRzF3l6I216KUnbJbxiRc0om1KqXAPzdNYXdY65clTrjLBJzBGXVOGoNIzp8Qxk6uWwW2+HcGs2zgTBV/A/H+BW9nwMCXjbolhljmLTPDanKQpJaOS9DuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=WfXFAQf5; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WfXFAQf5" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-45aeed46f5eso25443401cf.3 for ; Tue, 08 Oct 2024 00:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1728371179; x=1728975979; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jyYD6ArZVK45+VLwWpocZkjfjByfwzgnW1gPt6FS3DU=; b=WfXFAQf5MGJmroMzcHLYSZ/H/rnSfbJjzfb/qp5UUYvI4TL3bClGlIdCGkAL3otqLL s5KKw6IUctZOVa0RIiubE1Sy4Rwzxipgeev35ixIt/n7sEqEzXKugEngAkBqS2NuG+Ez oMRoM6HGEO61aMq4lB3iqutp1DlDZSjNOrodo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728371179; x=1728975979; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jyYD6ArZVK45+VLwWpocZkjfjByfwzgnW1gPt6FS3DU=; b=N5Yy+nFXVvObElcQyxPS/AHZez4FJUAtHhWmIGUqu1WjyUhFokaXq7BXE0B/PEViVP S+beQTuJuh7YZ4bwpYsARnuOLdWeuJQfBigNemT27mEBQ3VpGziN2NLaKRoXa3y19tMR 0P115F1Z4Ar7b0k59Je1KBy8ii4gxqE7Y8JicWwoA4yaTyUARyJr1Nhs28/aIA+CavGI bdB+rONaqNH7WClxMEUw78j49oQUwTy6in1jhRsxOJ/yE/+4RI9QD0YYLQ8hZs9WyKdA +PXIJV9LTF/QT2D9unNPP95Y/HfSEgCBmvALOBUDl802JrMDFlib1BH1oyF6y/apahAa rwcg== X-Forwarded-Encrypted: i=1; AJvYcCV2yAWJj4PRIr6Qf2FKTakuEZggM1ZowOLuia5w5rNpPhfxFbMSQfvjlIC25JRX7PfK3+CqZMiTDCGXKN8=@vger.kernel.org X-Gm-Message-State: AOJu0YzVF3dpimQvDCbJr9dHDTNHJLoCTIoLEweB0Q6MDlK92nHylyIb MFAkKAYheY4FXHHaJv+Bbgs9O+ggA1GctqrSnUWV4H2i9t2kMsnoTS/kj4zXAw== X-Google-Smtp-Source: AGHT+IHAXauuu8Lhecqd4BHK9YWDTOCb8kDvv55sLtE3EDVAYcD3iHT0tlmCSPXjU48F5uQjczxp0w== X-Received: by 2002:a05:622a:19a9:b0:458:2b7b:c453 with SMTP id d75a77b69052e-45d9ba2f097mr224135731cf.4.1728371179383; Tue, 08 Oct 2024 00:06:19 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45da764043esm33801921cf.88.2024.10.08.00.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 00:06:17 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 08 Oct 2024 07:06:14 +0000 Subject: [PATCH 1/3] media: uvcvideo: Support partial control reads Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241008-uvc-readless-v1-1-042ac4581f44@chromium.org> References: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> In-Reply-To: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> To: Laurent Pinchart , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda , stable@vger.kernel.org X-Mailer: b4 0.13.0 Some cameras, like the ELMO MX-P3, do not return all the bytes requested from a control if it can fit in less bytes. Eg: Returning 0xab instead of 0x00ab. usb 3-9: Failed to query (GET_DEF) UVC control 3 on unit 2: 1 (exp. 2). Extend the returned value from the camera and return it. Cc: stable@vger.kernel.org Fixes: a763b9fb58be ("media: uvcvideo: Do not return positive errors in uvc= _query_ctrl()") Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_video.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_= video.c index cd9c29532fb0..853dfb7b5f7b 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -79,11 +79,16 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8= unit, if (likely(ret =3D=3D size)) return 0; =20 + if (ret > 0 && ret < size) { + memset(data + ret, 0, size - ret); + return 0; + } + if (ret !=3D -EPIPE) { dev_err(&dev->udev->dev, "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", uvc_query_name(query), cs, unit, ret, size); - return ret < 0 ? ret : -EPIPE; + return ret ? ret : -EPIPE; } =20 /* Reuse data[0] to request the error code. */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Wed Nov 27 19:47:49 2024 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFB7E1FA253 for ; Tue, 8 Oct 2024 07:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371184; cv=none; b=KgWrfGp3Nq68IAGDgv1aFs6WKLBDB65Z/izwKHGegeLb7IedFwdww3mYLKzMy5Rjvx8adwNGaDCy2kziKLrrO683M4L/xggKRmFe/P7/NjWMEQoXIXTnh4azFKythBosCiDGizq7B0xr4PRc7rXSNtYdfgJdm4/RIENZwIRgzLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371184; c=relaxed/simple; bh=npkZZo7HZp404cjl+XlR7zlTgrfhIHuTn3dDOSGYTbw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kPeitIVze/ywRSkJupQLxaEBJbkY5i556P+MGtv+TlsHgKN9y3oUHwwIZBI5EZ8wh7vNGCztFGPwADaa5G7qjvINYsarLTererb/Xe3U8yW+y0TlSUyQlF/fCcCAbN9Wrc4yrq2aFy9GQZ3RsEof4czagBNNqxPq41ioPb3ct0A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=GDxwj+ci; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GDxwj+ci" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-45826431d4bso38183321cf.0 for ; Tue, 08 Oct 2024 00:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1728371182; x=1728975982; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/7J2ZIlNlOvxIZibX4IzDzB3bM7/Wb+XFb3DNRyUIUM=; b=GDxwj+ciELk+F50ciYUz5po8c8HD2wm8dmy79+LUjtgQQBdRejLdVtSBoL/i4kC9WP 3XeeP/u4DQuTclMdrV3N34TyAfAfPdTQhQ3UGggPZV6enJ73/D3Skl79nF5+ycwIdSyT DUa9uwhbH6J9k4VTnvVjSI4OBIj3owhmQK2e8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728371182; x=1728975982; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/7J2ZIlNlOvxIZibX4IzDzB3bM7/Wb+XFb3DNRyUIUM=; b=HJp0AHCPR2DnPGY6hXhm+7kHIRYYGMuR8pJSHYofStYMBtmRbFp6a6XPSov4yHkztP 2bEjR4CVuLmqUe9qUikfCBpWell3SsCnn5mz1QM8SGR0zXn5az0MN/UlvT1t2W3qZ0GV XKM7fcBD3yLsgvluIigO8CU4HTCEjGewfv81OsDpZWoT9DOiRsuwydQLH+VdfOhs+x4I DJ0dMy22M69yJ2c81g+YwyM2xrBSOmnOG/+hLB9BuQQOCqM1j0X7tFBUOFBe+4lN5NXs ZsmR5+SZyHxeqaXchJ3YfWFreqm2t6vt4vJidedMi1pjiNS2/tbTsKf4zdTaD/KqAl3u rlRQ== X-Forwarded-Encrypted: i=1; AJvYcCU9fqykYLFXyHUzhxXZpuzv3rMT0o9vva+ip6aJFdEpazH38DpAGQwm3pJt/rzhl0+CMQRz6awcTEds0C0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+e8+wjQLnJTq7/SOOa1mSSRLSLZj5/eZpYAY9+ZLgTBv0Ouq3 QSvfqu0bVdXPopVpZhsgueog8VOJoVd5gcmIm5V/jloVw5zr/+Pv+v/lls2pmA== X-Google-Smtp-Source: AGHT+IECQvqe+eitCmgIDnr0my9kUWAR7/3iHpD0qKi18vFvdGQnrYimF/N6FJPphFRr8SvzBZaE6Q== X-Received: by 2002:a05:622a:1445:b0:45e:ff0b:8b0b with SMTP id d75a77b69052e-45eff0b8cf3mr8821071cf.35.1728371181735; Tue, 08 Oct 2024 00:06:21 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45da764043esm33801921cf.88.2024.10.08.00.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 00:06:20 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 08 Oct 2024 07:06:15 +0000 Subject: [PATCH 2/3] media: uvcvideo: Refactor uvc_query_ctrl Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241008-uvc-readless-v1-2-042ac4581f44@chromium.org> References: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> In-Reply-To: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> To: Laurent Pinchart , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 Move the query control error logic to its own function. There is no functional change introduced by this patch. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_video.c | 45 ++++++++++++++++++++++-------------= ---- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_= video.c index 853dfb7b5f7b..a57272a2c9e1 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -67,30 +67,12 @@ static const char *uvc_query_name(u8 query) } } =20 -int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, - u8 intfnum, u8 cs, void *data, u16 size) +static int uvc_query_ctrl_error(struct uvc_device *dev, u8 intfnum, void *= data) { int ret; u8 error; u8 tmp; =20 - ret =3D __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size, - UVC_CTRL_CONTROL_TIMEOUT); - if (likely(ret =3D=3D size)) - return 0; - - if (ret > 0 && ret < size) { - memset(data + ret, 0, size - ret); - return 0; - } - - if (ret !=3D -EPIPE) { - dev_err(&dev->udev->dev, - "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", - uvc_query_name(query), cs, unit, ret, size); - return ret ? ret : -EPIPE; - } - /* Reuse data[0] to request the error code. */ tmp =3D *(u8 *)data; =20 @@ -135,6 +117,31 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u= 8 unit, return -EPIPE; } =20 +int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, + u8 intfnum, u8 cs, void *data, u16 size) +{ + int ret; + + ret =3D __uvc_query_ctrl(dev, query, unit, intfnum, cs, data, size, + UVC_CTRL_CONTROL_TIMEOUT); + if (likely(ret =3D=3D size)) + return 0; + + if (ret =3D=3D -EPIPE) + return uvc_query_ctrl_error(dev, intfnum, data); + + dev_err(&dev->udev->dev, + "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", + uvc_query_name(query), cs, unit, ret, size); + + if (ret > 0 && ret < size) { + memset(data + ret, 0, size - ret); + return 0; + } + + return ret ? ret : -EPIPE; +} + static const struct usb_device_id elgato_cam_link_4k =3D { USB_DEVICE(0x0fd9, 0x0066) }; --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Wed Nov 27 19:47:49 2024 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 758061FAC29 for ; Tue, 8 Oct 2024 07:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371186; cv=none; b=LVDWs0i6O2Ye+DUN7TudUkh05MALiE0bhDNcQnPjl7Y/qMSGd0hlp9bnNtOySAOk+cIGeVv/LkrigMbQLS3CYsri+4xnBa4CHOWz4WxDHcOgAOQqk7QhIuRHzjY68NJ3vnb0zwkTz5Ccp3+SG+AvnKaRauanqBadn4XFHVM58XM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728371186; c=relaxed/simple; bh=d5b7dVLR3ZR74qnhfrQJ5ldkhIB/k3f0HhwHYi75Hio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iUarFjMtVLxcJTySNyLbKRPX5zVn2zxFEtyUX07JOvwLSketG2/WhouuPzGAyMNouHJC2B4bUSr0dd/LJqlOlGhSPMjUETRYlncYMWTzXlihNzVssK51FaVcc6DzeffYsAG/mynOi49AT9jyy7Nie1ZaGb7zUQ6cQRry4TuQWlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=iqVKYuuq; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iqVKYuuq" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-45f05a65398so589991cf.1 for ; Tue, 08 Oct 2024 00:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1728371184; x=1728975984; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jDX1gk9WLS0lOp3uclg0B3j1XeJVdEOnGdjwzsvJlzE=; b=iqVKYuuq909fG5Ig77lAqHozDxJB1cJlQ9q5+vZ4vkDwKEaoA2JhEtiSKIPF+6uYbL mXkBXarILRptzv4eSYN34Rvewbuo/246OXafNEE1RUlmfw0n4Ts/kVpp8Ww4sJC+xykf uOvgwt/X+s0HP3Ac+E1reHbBFqVMFoNJ9uGRE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728371184; x=1728975984; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jDX1gk9WLS0lOp3uclg0B3j1XeJVdEOnGdjwzsvJlzE=; b=aD33qTMaWi715e51APCU3JZc9f9oxBplePFwYc5jHYLCa/LeOqBj4lq1JXSxVqJHnv NKh+wDq6Jg7BGcoZ14qgCnXDS7q/uKvpGDnAFoXMQytjyw13zSQrwBCeFLRK1AvtNdoF Z8TUUtl8VvGmZ+KiSn0Nb+UWmamEx/H2QmknHS4w93MNTBMq61Q0R8UmGnJ4+N6y+2bs pG3BxD2BK/lfkZecdeBy6QFAHHsGIDwoLAO5hrnZRBgEPuOQF2VCYMh3PfvfJ3dljrZh sF5y675C8/9GUwdQpBFRUVX0gqyR7z+qK/iTufhJechx4qnpX/47EIYvoAuHwo/51QKI uu/A== X-Forwarded-Encrypted: i=1; AJvYcCWNkfdkx+M+NK1lYfIot1x1JJq0jQXYcc/ctea9gW19HOXcs43KPIIe6q9tQfdZMwM2q16kfxEncpTnxyA=@vger.kernel.org X-Gm-Message-State: AOJu0YzV9FNFIZ6cv/gNRpMBnQ9diic1HORfqgq1501vh0hqNMo9GzG5 kgeGtL9coNFi0JgLts9SWJxpcvc/HyXOLJcv4KYI4WRbFsNlek9wsF1L3vDL8Q== X-Google-Smtp-Source: AGHT+IG39BBoTTcIAWGA9WiMjv/rkPGoXXlsuN2UqZIeIx/T7ZMNueHs9O13LRs8lKx5eIeZ5zSWSw== X-Received: by 2002:ac8:7fd0:0:b0:44f:f287:c9b4 with SMTP id d75a77b69052e-45d9bb5b04bmr203085781cf.44.1728371184187; Tue, 08 Oct 2024 00:06:24 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45da764043esm33801921cf.88.2024.10.08.00.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 00:06:22 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 08 Oct 2024 07:06:16 +0000 Subject: [PATCH 3/3] media: uvcvideo: Add more logging to uvc_query_ctrl_error() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241008-uvc-readless-v1-3-042ac4581f44@chromium.org> References: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> In-Reply-To: <20241008-uvc-readless-v1-0-042ac4581f44@chromium.org> To: Laurent Pinchart , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 If we fail to query the ctrl error there is no information on dmesg or in uvc_dbg, which makes it difficult to debug Reorder the log position to fix this. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_= video.c index a57272a2c9e1..bdc3f545a15e 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -83,11 +83,11 @@ static int uvc_query_ctrl_error(struct uvc_device *dev,= u8 intfnum, void *data) error =3D *(u8 *)data; *(u8 *)data =3D tmp; =20 + uvc_dbg(dev, CONTROL, "Control error %u, ret %d\n", error, ret); + if (ret !=3D 1) return ret < 0 ? ret : -EPIPE; =20 - uvc_dbg(dev, CONTROL, "Control error %u\n", error); - switch (error) { case 0: /* Cannot happen - we received a STALL */ --=20 2.47.0.rc0.187.ge670bccf7e-goog