]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: vidtv: psi: fix missing assignments in while loops
authorDaniel W. S. Almeida <dwlsalmeida@gmail.com>
Sat, 31 Oct 2020 15:05:52 +0000 (16:05 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 26 Nov 2020 06:40:36 +0000 (07:40 +0100)
Some variables were only assigned once but were used in while
loops as if they had been updated at every iteration. Fix this.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/test-drivers/vidtv/vidtv_psi.c

index ad2957efa483b61e4749a762d3a0a60756912c84..4dda5b0004a341a7e322cb2979b97a4073768e0f 100644 (file)
@@ -1175,9 +1175,7 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args)
 
        struct vidtv_psi_desc *table_descriptor   = args.pmt->descriptor;
        struct vidtv_psi_table_pmt_stream *stream = args.pmt->stream;
-       struct vidtv_psi_desc *stream_descriptor  = (stream) ?
-                                                   args.pmt->stream->descriptor :
-                                                   NULL;
+       struct vidtv_psi_desc *stream_descriptor;
 
        struct header_write_args h_args = {};
        struct psi_write_args psi_args  = {};
@@ -1237,6 +1235,8 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args)
 
                nbytes += vidtv_psi_ts_psi_write_into(psi_args);
 
+               stream_descriptor = stream->descriptor;
+
                while (stream_descriptor) {
                        /* write the stream descriptors, if any */
                        d_args.dest_buf           = args.buf;
@@ -1324,9 +1324,7 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args)
        u32 crc = INITIAL_CRC;
 
        struct vidtv_psi_table_sdt_service *service = args.sdt->service;
-       struct vidtv_psi_desc *service_desc = (args.sdt->service) ?
-                                             args.sdt->service->descriptor :
-                                             NULL;
+       struct vidtv_psi_desc *service_desc;
 
        struct header_write_args h_args = {};
        struct psi_write_args psi_args  = {};
@@ -1373,6 +1371,8 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args)
 
                nbytes += vidtv_psi_ts_psi_write_into(psi_args);
 
+               service_desc = service->descriptor;
+
                while (service_desc) {
                        /* copy the service descriptors, if any */
                        d_args.dest_buf           = args.buf;
@@ -1616,9 +1616,7 @@ u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_write_args args)
 
        struct vidtv_psi_desc *table_descriptor     = args.nit->descriptor;
        struct vidtv_psi_table_transport *transport = args.nit->transport;
-       struct vidtv_psi_desc *transport_descriptor = (transport) ?
-                                                      args.nit->transport->descriptor :
-                                                      NULL;
+       struct vidtv_psi_desc *transport_descriptor;
 
        struct header_write_args h_args = {};
        struct psi_write_args psi_args  = {};
@@ -1686,6 +1684,8 @@ u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_write_args args)
 
                nbytes += vidtv_psi_ts_psi_write_into(psi_args);
 
+               transport_descriptor = transport->descriptor;
+
                while (transport_descriptor) {
                        /* write the transport descriptors, if any */
                        d_args.dest_buf           = args.buf;
@@ -1823,9 +1823,7 @@ u32 vidtv_psi_eit_write_into(struct vidtv_psi_eit_write_args args)
        u32 crc = INITIAL_CRC;
 
        struct vidtv_psi_table_eit_event *event = args.eit->event;
-       struct vidtv_psi_desc *event_descriptor = (args.eit->event) ?
-                                                  args.eit->event->descriptor :
-                                                  NULL;
+       struct vidtv_psi_desc *event_descriptor;
 
        struct header_write_args h_args = {};
        struct psi_write_args psi_args  = {};