These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / media / pci / bt8xx / dst_ca.c
index c22c4ae..c5cc14e 100644 (file)
@@ -320,29 +320,27 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message,
        if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg)))
                return -EFAULT;
 
-       if (p_ca_message->msg) {
-               dprintk(verbose, DST_CA_NOTICE, 1, " Message = [%*ph]",
-                       3, p_ca_message->msg);
-
-               for (i = 0; i < 3; i++) {
-                       command = command | p_ca_message->msg[i];
-                       if (i < 2)
-                               command = command << 8;
-               }
-               dprintk(verbose, DST_CA_NOTICE, 1, " Command=[0x%x]", command);
+       dprintk(verbose, DST_CA_NOTICE, 1, " Message = [%*ph]",
+               3, p_ca_message->msg);
 
-               switch (command) {
-               case CA_APP_INFO:
-                       memcpy(p_ca_message->msg, state->messages, 128);
-                       if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
-                               return -EFAULT;
-                       break;
-               case CA_INFO:
-                       memcpy(p_ca_message->msg, state->messages, 128);
-                       if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
-                               return -EFAULT;
-                       break;
-               }
+       for (i = 0; i < 3; i++) {
+               command = command | p_ca_message->msg[i];
+               if (i < 2)
+                       command = command << 8;
+       }
+       dprintk(verbose, DST_CA_NOTICE, 1, " Command=[0x%x]", command);
+
+       switch (command) {
+       case CA_APP_INFO:
+               memcpy(p_ca_message->msg, state->messages, 128);
+               if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
+                       return -EFAULT;
+               break;
+       case CA_INFO:
+               memcpy(p_ca_message->msg, state->messages, 128);
+               if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
+                       return -EFAULT;
+               break;
        }
 
        return 0;
@@ -494,60 +492,58 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message,
                goto free_mem_and_exit;
        }
 
+       /*      EN50221 tag     */
+       command = 0;
 
-       if (p_ca_message->msg) {
-               /*      EN50221 tag     */
-               command = 0;
+       for (i = 0; i < 3; i++) {
+               command = command | p_ca_message->msg[i];
+               if (i < 2)
+                       command = command << 8;
+       }
+       dprintk(verbose, DST_CA_DEBUG, 1, " Command=[0x%x]\n", command);
 
-               for (i = 0; i < 3; i++) {
-                       command = command | p_ca_message->msg[i];
-                       if (i < 2)
-                               command = command << 8;
+       switch (command) {
+       case CA_PMT:
+               dprintk(verbose, DST_CA_DEBUG, 1, "Command = SEND_CA_PMT");
+               if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) {   // code simplification started
+                       dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT Failed !");
+                       result = -1;
+                       goto free_mem_and_exit;
                }
-               dprintk(verbose, DST_CA_DEBUG, 1, " Command=[0x%x]\n", command);
-
-               switch (command) {
-               case CA_PMT:
-                       dprintk(verbose, DST_CA_DEBUG, 1, "Command = SEND_CA_PMT");
-                       if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) {   // code simplification started
-                               dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT Failed !");
-                               result = -1;
-                               goto free_mem_and_exit;
-                       }
-                       dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT Success !");
-                       break;
-               case CA_PMT_REPLY:
-                       dprintk(verbose, DST_CA_INFO, 1, "Command = CA_PMT_REPLY");
-                       /*      Have to handle the 2 basic types of cards here  */
-                       if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) {
-                               dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT_REPLY Failed !");
-                               result = -1;
-                               goto free_mem_and_exit;
-                       }
-                       dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT_REPLY Success !");
-                       break;
-               case CA_APP_INFO_ENQUIRY:               // only for debugging
-                       dprintk(verbose, DST_CA_INFO, 1, " Getting Cam Application information");
-
-                       if ((ca_get_app_info(state)) < 0) {
-                               dprintk(verbose, DST_CA_ERROR, 1, " -->CA_APP_INFO_ENQUIRY Failed !");
-                               result = -1;
-                               goto free_mem_and_exit;
-                       }
-                       dprintk(verbose, DST_CA_INFO, 1, " -->CA_APP_INFO_ENQUIRY Success !");
-                       break;
-               case CA_INFO_ENQUIRY:
-                       dprintk(verbose, DST_CA_INFO, 1, " Getting CA Information");
-
-                       if ((ca_get_ca_info(state)) < 0) {
-                               dprintk(verbose, DST_CA_ERROR, 1, " -->CA_INFO_ENQUIRY Failed !");
-                               result = -1;
-                               goto free_mem_and_exit;
-                       }
-                       dprintk(verbose, DST_CA_INFO, 1, " -->CA_INFO_ENQUIRY Success !");
-                       break;
+               dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT Success !");
+               break;
+       case CA_PMT_REPLY:
+               dprintk(verbose, DST_CA_INFO, 1, "Command = CA_PMT_REPLY");
+               /*      Have to handle the 2 basic types of cards here  */
+               if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) {
+                       dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT_REPLY Failed !");
+                       result = -1;
+                       goto free_mem_and_exit;
+               }
+               dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT_REPLY Success !");
+               break;
+       case CA_APP_INFO_ENQUIRY:               // only for debugging
+               dprintk(verbose, DST_CA_INFO, 1, " Getting Cam Application information");
+
+               if ((ca_get_app_info(state)) < 0) {
+                       dprintk(verbose, DST_CA_ERROR, 1, " -->CA_APP_INFO_ENQUIRY Failed !");
+                       result = -1;
+                       goto free_mem_and_exit;
                }
+               dprintk(verbose, DST_CA_INFO, 1, " -->CA_APP_INFO_ENQUIRY Success !");
+               break;
+       case CA_INFO_ENQUIRY:
+               dprintk(verbose, DST_CA_INFO, 1, " Getting CA Information");
+
+               if ((ca_get_ca_info(state)) < 0) {
+                       dprintk(verbose, DST_CA_ERROR, 1, " -->CA_INFO_ENQUIRY Failed !");
+                       result = -1;
+                       goto free_mem_and_exit;
+               }
+               dprintk(verbose, DST_CA_INFO, 1, " -->CA_INFO_ENQUIRY Success !");
+               break;
        }
+
 free_mem_and_exit:
        kfree (hw_buffer);