Skip to content

Commit d5eae51

Browse files
Stefan Herdleropsiff
authored andcommitted
media: av7110: coding style fixes: deep_indentation
This patch fixes most the following checkpatch warnings: WARNING:DEEP_INDENTATION: Too many leading tabs - consider code refactoring Invert "if" statement to reduce indention level by 1. Signed-off-by: Stefan Herdler <herdler@nurfuerspam.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> (cherry picked from commit 908b202) Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability") Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 230e9a7 commit d5eae51

1 file changed

Lines changed: 117 additions & 117 deletions

File tree

drivers/staging/media/av7110/av7110_ipack.c

Lines changed: 117 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -249,146 +249,146 @@ int av7110_ipack_instant_repack(const u8 *buf, int count, struct ipack *p)
249249
if (!p->plength)
250250
p->plength = MMAX_PLENGTH - 6;
251251

252-
if (p->done || ((p->mpeg == 2 && p->found >= 9) ||
253-
(p->mpeg == 1 && p->found >= 7))) {
254-
switch (p->cid) {
255-
case AUDIO_STREAM_S ... AUDIO_STREAM_E:
256-
case VIDEO_STREAM_S ... VIDEO_STREAM_E:
257-
case PRIVATE_STREAM1:
258-
if (p->mpeg == 2 && p->found == 9) {
259-
write_ipack(p, &p->flag1, 1);
260-
write_ipack(p, &p->flag2, 1);
261-
write_ipack(p, &p->hlength, 1);
252+
if (!(p->done || ((p->mpeg == 2 && p->found >= 9) ||
253+
(p->mpeg == 1 && p->found >= 7))))
254+
return count;
255+
256+
switch (p->cid) {
257+
case AUDIO_STREAM_S ... AUDIO_STREAM_E:
258+
case VIDEO_STREAM_S ... VIDEO_STREAM_E:
259+
case PRIVATE_STREAM1:
260+
if (p->mpeg == 2 && p->found == 9) {
261+
write_ipack(p, &p->flag1, 1);
262+
write_ipack(p, &p->flag2, 1);
263+
write_ipack(p, &p->hlength, 1);
264+
}
265+
266+
if (p->mpeg == 1 && p->found == 7)
267+
write_ipack(p, &p->flag1, 1);
268+
269+
if (p->mpeg == 2 && (p->flag2 & PTS_ONLY) && p->found < 14) {
270+
while (c < count && p->found < 14) {
271+
p->pts[p->found - 9] = buf[c];
272+
write_ipack(p, buf + c, 1);
273+
c++;
274+
p->found++;
262275
}
276+
if (c == count)
277+
return count;
278+
}
263279

264-
if (p->mpeg == 1 && p->found == 7)
265-
write_ipack(p, &p->flag1, 1);
280+
if (p->mpeg == 1 && p->which < 2000) {
281+
if (p->found == 7) {
282+
p->check = p->flag1;
283+
p->hlength = 1;
284+
}
266285

267-
if (p->mpeg == 2 && (p->flag2 & PTS_ONLY) &&
268-
p->found < 14) {
269-
while (c < count && p->found < 14) {
270-
p->pts[p->found - 9] = buf[c];
271-
write_ipack(p, buf + c, 1);
272-
c++;
273-
p->found++;
274-
}
275-
if (c == count)
276-
return count;
286+
while (!p->which && c < count && p->check == 0xff) {
287+
p->check = buf[c];
288+
write_ipack(p, buf + c, 1);
289+
c++;
290+
p->found++;
291+
p->hlength++;
277292
}
278293

279-
if (p->mpeg == 1 && p->which < 2000) {
280-
if (p->found == 7) {
281-
p->check = p->flag1;
282-
p->hlength = 1;
283-
}
294+
if (c == count)
295+
return count;
284296

285-
while (!p->which && c < count &&
286-
p->check == 0xff){
287-
p->check = buf[c];
288-
write_ipack(p, buf + c, 1);
289-
c++;
290-
p->found++;
291-
p->hlength++;
292-
}
297+
if ((p->check & 0xc0) == 0x40 && !p->which) {
298+
p->check = buf[c];
299+
write_ipack(p, buf + c, 1);
300+
c++;
301+
p->found++;
302+
p->hlength++;
293303

304+
p->which = 1;
305+
if (c == count)
306+
return count;
307+
p->check = buf[c];
308+
write_ipack(p, buf + c, 1);
309+
c++;
310+
p->found++;
311+
p->hlength++;
312+
p->which = 2;
294313
if (c == count)
295314
return count;
315+
}
296316

297-
if ((p->check & 0xc0) == 0x40 && !p->which) {
298-
p->check = buf[c];
299-
write_ipack(p, buf + c, 1);
300-
c++;
301-
p->found++;
302-
p->hlength++;
317+
if (p->which == 1) {
318+
p->check = buf[c];
319+
write_ipack(p, buf + c, 1);
320+
c++;
321+
p->found++;
322+
p->hlength++;
323+
p->which = 2;
324+
if (c == count)
325+
return count;
326+
}
303327

304-
p->which = 1;
305-
if (c == count)
306-
return count;
307-
p->check = buf[c];
308-
write_ipack(p, buf + c, 1);
309-
c++;
310-
p->found++;
311-
p->hlength++;
312-
p->which = 2;
313-
if (c == count)
314-
return count;
315-
}
328+
if ((p->check & 0x30) && p->check != 0xff) {
329+
p->flag2 = (p->check & 0xf0) << 2;
330+
p->pts[0] = p->check;
331+
p->which = 3;
332+
}
316333

317-
if (p->which == 1) {
318-
p->check = buf[c];
319-
write_ipack(p, buf + c, 1);
320-
c++;
321-
p->found++;
322-
p->hlength++;
323-
p->which = 2;
334+
if (c == count)
335+
return count;
336+
if (p->which > 2) {
337+
if ((p->flag2 & PTS_DTS_FLAGS) == PTS_ONLY) {
338+
while (c < count && p->which < 7) {
339+
p->pts[p->which - 2] = buf[c];
340+
write_ipack(p, buf + c, 1);
341+
c++;
342+
p->found++;
343+
p->which++;
344+
p->hlength++;
345+
}
324346
if (c == count)
325347
return count;
326-
}
327-
328-
if ((p->check & 0x30) && p->check != 0xff) {
329-
p->flag2 = (p->check & 0xf0) << 2;
330-
p->pts[0] = p->check;
331-
p->which = 3;
332-
}
333-
334-
if (c == count)
335-
return count;
336-
if (p->which > 2) {
337-
if ((p->flag2 & PTS_DTS_FLAGS) == PTS_ONLY) {
338-
while (c < count && p->which < 7) {
348+
} else if ((p->flag2 & PTS_DTS_FLAGS) == PTS_DTS) {
349+
while (c < count && p->which < 12) {
350+
if (p->which < 7)
339351
p->pts[p->which - 2] = buf[c];
340-
write_ipack(p, buf + c, 1);
341-
c++;
342-
p->found++;
343-
p->which++;
344-
p->hlength++;
345-
}
346-
if (c == count)
347-
return count;
348-
} else if ((p->flag2 & PTS_DTS_FLAGS) == PTS_DTS) {
349-
while (c < count && p->which < 12) {
350-
if (p->which < 7)
351-
p->pts[p->which - 2] = buf[c];
352-
write_ipack(p, buf + c, 1);
353-
c++;
354-
p->found++;
355-
p->which++;
356-
p->hlength++;
357-
}
358-
if (c == count)
359-
return count;
352+
write_ipack(p, buf + c, 1);
353+
c++;
354+
p->found++;
355+
p->which++;
356+
p->hlength++;
360357
}
361-
p->which = 2000;
358+
if (c == count)
359+
return count;
362360
}
361+
p->which = 2000;
363362
}
364-
365-
while (c < count && p->found < p->plength + 6) {
366-
l = count - c;
367-
if (l + p->found > p->plength + 6)
368-
l = p->plength + 6 - p->found;
369-
write_ipack(p, buf + c, l);
370-
p->found += l;
371-
c += l;
372-
}
373-
break;
374363
}
375364

376-
if (p->done) {
377-
if (p->found + count - c < p->plength + 6) {
378-
p->found += count - c;
379-
c = count;
380-
} else {
381-
c += p->plength + 6 - p->found;
382-
p->found = p->plength + 6;
383-
}
365+
while (c < count && p->found < p->plength + 6) {
366+
l = count - c;
367+
if (l + p->found > p->plength + 6)
368+
l = p->plength + 6 - p->found;
369+
write_ipack(p, buf + c, l);
370+
p->found += l;
371+
c += l;
384372
}
373+
break;
374+
}
385375

386-
if (p->plength && p->found == p->plength + 6) {
387-
send_ipack(p);
388-
av7110_ipack_reset(p);
389-
if (c < count)
390-
av7110_ipack_instant_repack(buf + c, count - c, p);
376+
if (p->done) {
377+
if (p->found + count - c < p->plength + 6) {
378+
p->found += count - c;
379+
c = count;
380+
} else {
381+
c += p->plength + 6 - p->found;
382+
p->found = p->plength + 6;
391383
}
392384
}
385+
386+
if (p->plength && p->found == p->plength + 6) {
387+
send_ipack(p);
388+
av7110_ipack_reset(p);
389+
if (c < count)
390+
av7110_ipack_instant_repack(buf + c, count - c, p);
391+
}
392+
393393
return count;
394394
}

0 commit comments

Comments
 (0)