Commit 2c50c686 authored by Alexandra Winter's avatar Alexandra Winter Committed by David S. Miller

s390/ctcm: fix variable dereferenced before check

Found by cppcheck and smatch.
smatch complains about
drivers/s390/net/ctcm_sysfs.c:43 ctcm_buffer_write() warn: variable dereferenced before check 'priv' (see line 42)

Fixes: 3c09e264 ("ctcm: rename READ/WRITE defines to avoid redefinitions")
Reported-by: default avatarColin Ian King <colin.i.king@gmail.com>
Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2423b0d0
...@@ -39,11 +39,12 @@ static ssize_t ctcm_buffer_write(struct device *dev, ...@@ -39,11 +39,12 @@ static ssize_t ctcm_buffer_write(struct device *dev,
struct ctcm_priv *priv = dev_get_drvdata(dev); struct ctcm_priv *priv = dev_get_drvdata(dev);
int rc; int rc;
ndev = priv->channel[CTCM_READ]->netdev; if (!(priv && priv->channel[CTCM_READ] &&
if (!(priv && priv->channel[CTCM_READ] && ndev)) { priv->channel[CTCM_READ]->netdev)) {
CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev"); CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev");
return -ENODEV; return -ENODEV;
} }
ndev = priv->channel[CTCM_READ]->netdev;
rc = kstrtouint(buf, 0, &bs1); rc = kstrtouint(buf, 0, &bs1);
if (rc) if (rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment