raw/ifpga/base: fix logically dead code
authorTianfei Zhang <tianfei.zhang@intel.com>
Fri, 21 Jun 2019 08:40:14 +0000 (16:40 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 4 Jul 2019 13:34:55 +0000 (15:34 +0200)
add temporary variable in max10_reg_write().

Coverity issue: 337927
Fixes: 96ebfcf ("raw/ifpga/base: add SPI and MAX10 device driver")
Cc: stable@dpdk.org
Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
drivers/raw/ifpga_rawdev/base/opae_intel_max10.c

index f354ee4..3ff6575 100644 (file)
@@ -17,11 +17,13 @@ int max10_reg_read(unsigned int reg, unsigned int *val)
 
 int max10_reg_write(unsigned int reg, unsigned int val)
 {
+       unsigned int tmp = val;
+
        if (!g_max10)
                return -ENODEV;
 
        return spi_transaction_write(g_max10->spi_tran_dev,
-                       reg, 4, (unsigned char *)&val);
+                       reg, 4, (unsigned char *)&tmp);
 }
 
 struct intel_max10_device *
@@ -57,7 +59,7 @@ intel_max10_device_probe(struct altera_spi_device *spi,
 
        /* set PKVL Polling manually in BBS */
        ret = max10_reg_write(PKVL_POLLING_CTRL, 0x3);
-       if (ret) {
+       if (ret != 0) {
                dev_err(dev, "%s set PKVL polling fail\n", __func__);
                goto spi_tran_fail;
        }