hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/media/usb/pwc/pwc-ctrl.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Driver for Philips webcam
23 Functions that send various control messages to the webcam, including
34 video modes.
....@@ -15,19 +16,6 @@
1516 The decompression routines have been implemented by reverse-engineering the
1617 Nemosoft binary pwcx module. Caveat emptor.
1718
18
- This program is free software; you can redistribute it and/or modify
19
- it under the terms of the GNU General Public License as published by
20
- the Free Software Foundation; either version 2 of the License, or
21
- (at your option) any later version.
22
-
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
-
28
- You should have received a copy of the GNU General Public License
29
- along with this program; if not, write to the Free Software
30
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3119 */
3220
3321 /*
....@@ -242,14 +230,14 @@
242230 fps = (frames / 5) - 1;
243231
244232 /* Find a supported framerate with progressively higher compression */
245
- pChoose = NULL;
246
- while (*compression <= 3) {
233
+ do {
247234 pChoose = &Timon_table[size][fps][*compression];
248235 if (pChoose->alternate != 0)
249236 break;
250237 (*compression)++;
251
- }
252
- if (pChoose == NULL || pChoose->alternate == 0)
238
+ } while (*compression <= 3);
239
+
240
+ if (pChoose->alternate == 0)
253241 return -ENOENT; /* Not supported. */
254242
255243 if (send_to_cam)
....@@ -279,7 +267,7 @@
279267 static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt,
280268 int frames, int *compression, int send_to_cam)
281269 {
282
- const struct Kiara_table_entry *pChoose = NULL;
270
+ const struct Kiara_table_entry *pChoose;
283271 int fps, ret = 0;
284272
285273 if (size >= PSZ_MAX || *compression < 0 || *compression > 3)
....@@ -293,13 +281,14 @@
293281 fps = (frames / 5) - 1;
294282
295283 /* Find a supported framerate with progressively higher compression */
296
- while (*compression <= 3) {
284
+ do {
297285 pChoose = &Kiara_table[size][fps][*compression];
298286 if (pChoose->alternate != 0)
299287 break;
300288 (*compression)++;
301
- }
302
- if (pChoose == NULL || pChoose->alternate == 0)
289
+ } while (*compression <= 3);
290
+
291
+ if (pChoose->alternate == 0)
303292 return -ENOENT; /* Not supported. */
304293
305294 /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */
....@@ -534,7 +523,7 @@
534523 #ifdef CONFIG_USB_PWC_DEBUG
535524 int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
536525 {
537
- int ret = -1, request;
526
+ int ret, request;
538527
539528 if (pdev->type < 675)
540529 request = SENSOR_TYPE_FORMATTER1;