net/mlx5: fix return value of start operation
[dpdk.git] / drivers / net / sfc / base / mcdi_mon.c
index 8ea4216..e4de0da 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2009-2016 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
+ * Copyright (c) 2009-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -396,6 +372,11 @@ efx_mcdi_sensor_info(
 
        EFSYS_ASSERT(sensor_maskp != NULL);
 
+       if (npages < 1) {
+               rc = EINVAL;
+               goto fail1;
+       }
+
        for (page = 0; page < npages; page++) {
                uint32_t mask;
 
@@ -412,7 +393,7 @@ efx_mcdi_sensor_info(
 
                if (req.emr_rc != 0) {
                        rc = req.emr_rc;
-                       goto fail1;
+                       goto fail2;
                }
 
                mask = MCDI_OUT_DWORD(req, SENSOR_INFO_OUT_MASK);
@@ -420,18 +401,20 @@ efx_mcdi_sensor_info(
                if ((page != (npages - 1)) &&
                    ((mask & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) == 0)) {
                        rc = EINVAL;
-                       goto fail2;
+                       goto fail3;
                }
                sensor_maskp[page] = mask;
        }
 
        if (sensor_maskp[npages - 1] & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) {
                rc = EINVAL;
-               goto fail3;
+               goto fail4;
        }
 
        return (0);
 
+fail4:
+       EFSYS_PROBE(fail4);
 fail3:
        EFSYS_PROBE(fail3);
 fail2: