Print this page
10689 srpt_cm_conn_closed_hdlr() needs a smatch fix

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c
          +++ new/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
       27 + * Copyright 2019, Joyent, Inc.
       28 + */
       29 +
       30 +/*
  27   31   * IB CM handlers for s Solaris SCSI RDMA Protocol Target (SRP)
  28   32   * transport port provider module for the COMSTAR framework.
  29   33   */
  30   34  
  31   35  #include <sys/cpuvar.h>
  32   36  #include <sys/types.h>
  33   37  #include <sys/conf.h>
  34   38  #include <sys/stat.h>
  35   39  #include <sys/file.h>
  36   40  #include <sys/ddi.h>
↓ open down ↓ 18 lines elided ↑ open up ↑
  55   59  extern srpt_ctxt_t  *srpt_ctxt;
  56   60  
  57   61  /*
  58   62   * srpt_cm_req_hdlr() - Login request
  59   63   *
  60   64   * CM has called back with a CM REQ message associated with an
  61   65   * SRP initiator login request.
  62   66   */
  63   67  static ibt_cm_status_t
  64   68  srpt_cm_req_hdlr(srpt_target_port_t *tgt, ibt_cm_event_t *event,
  65      -        ibt_cm_return_args_t *ret_args, void *ret_priv_data,
  66      -        ibt_priv_data_len_t ret_priv_data_len)
       69 +    ibt_cm_return_args_t *ret_args, void *ret_priv_data,
       70 +    ibt_priv_data_len_t ret_priv_data_len)
  67   71  {
  68   72          ibt_cm_status_t         status;
  69   73          ibt_cm_req_rcv_t        *req;
  70   74          srp_login_req_t         login;
  71   75          srp_login_rej_t         login_rej;
  72   76          srp_login_rsp_t         login_rsp;
  73   77          srpt_channel_t          *ch = NULL;
  74   78          char                    remote_gid[SRPT_ALIAS_LEN];
  75   79          char                    local_gid[SRPT_ALIAS_LEN];
  76   80  
↓ open down ↓ 160 lines elided ↑ open up ↑
 237  241          case IBT_CM_CLOSED_STALE:
 238  242                  /*
 239  243                   * These cases indicate that the SRP initiator is closing
 240  244                   * the channel.  CM will have already closed the RC channel,
 241  245                   * so simply initiate cleanup which will remove the target
 242  246                   * ports reference to the channel and then release the
 243  247                   * reference held by the CM.
 244  248                   */
 245  249                  SRPT_DPRINTF_L3("cm_conn_closed_hdlr, remote close,"
 246  250                      " free channel");
 247      -                if (ch != NULL) {
 248      -                        srpt_ch_cleanup(ch);
 249      -                        srpt_ch_release_ref(ch, 1);
 250      -                } else {
 251      -                        SRPT_DPRINTF_L2("cm_conn_closed_hdlr, NULL channel");
 252      -                }
      251 +                srpt_ch_cleanup(ch);
      252 +                srpt_ch_release_ref(ch, 1);
 253  253                  break;
 254  254  
 255  255          default:
 256  256                  SRPT_DPRINTF_L2("cm_conn_closed_hdlr, unknown close type (%d)",
 257  257                      event->cm_event.closed);
 258  258                  status = IBT_CM_DEFAULT;
 259  259                  break;
 260  260          }
 261  261          return (status);
 262  262  }
↓ open down ↓ 22 lines elided ↑ open up ↑
 285  285          srpt_ch_release_ref(ch, 1);
 286  286  
 287  287          return (IBT_CM_ACCEPT);
 288  288  }
 289  289  
 290  290  /*
 291  291   * srpt_cm_hdlr() - CM call-back handler.
 292  292   */
 293  293  ibt_cm_status_t
 294  294  srpt_cm_hdlr(void *cm_private, ibt_cm_event_t *event,
 295      -        ibt_cm_return_args_t *ret_args, void *ret_priv_data,
 296      -        ibt_priv_data_len_t ret_len_max)
      295 +    ibt_cm_return_args_t *ret_args, void *ret_priv_data,
      296 +    ibt_priv_data_len_t ret_len_max)
 297  297  {
 298  298          ibt_cm_status_t         status = IBT_CM_ACCEPT;
 299  299  
 300  300          switch (event->cm_type) {
 301  301  
 302  302          case IBT_CM_EVENT_REQ_RCV:
 303  303                  SRPT_DPRINTF_L3("cm_hdlr, REQ received");
 304  304                  status = srpt_cm_req_hdlr((srpt_target_port_t *)cm_private,
 305  305                      event, ret_args, ret_priv_data, ret_len_max);
 306  306                  break;
↓ open down ↓ 41 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX