From: Tianfei Zhang Date: Fri, 21 Jun 2019 08:40:14 +0000 (+0800) Subject: raw/ifpga/base: fix logically dead code X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8e80eb4e6222c961f7d79c26dfae8123c4284b8f;p=dpdk.git raw/ifpga/base: fix logically dead code 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 Acked-by: Rosen Xu --- diff --git a/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c b/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c index f354ee4b61..3ff6575d71 100644 --- a/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c +++ b/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c @@ -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; }