summaryrefslogtreecommitdiff
path: root/drivers/fsi
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-07-12 04:53:37 +0300
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-07-12 04:53:37 +0300
commitd5c66e61e7fee82c50c04af8b69c1b88ce173b95 (patch)
tree22957751068487f368d0bcd1256bada193a67f49 /drivers/fsi
parent32f7f89d3065d950a3524c91f4031acc129195cc (diff)
downloadlinux-d5c66e61e7fee82c50c04af8b69c1b88ce173b95.tar.xz
fsi: sbefifo: Fix checker warning about late NULL check
"dev" is dereferences before it's checked. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/fsi')
-rw-r--r--drivers/fsi/fsi-sbefifo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index a34ff997ca9d..6b31cc24fb0d 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -706,13 +706,16 @@ static int __sbefifo_submit(struct sbefifo *sbefifo,
int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
__be32 *response, size_t *resp_len)
{
- struct sbefifo *sbefifo = dev_get_drvdata(dev);
+ struct sbefifo *sbefifo;
struct iov_iter resp_iter;
struct kvec resp_iov;
size_t rbytes;
int rc;
- if (!dev || !sbefifo)
+ if (!dev)
+ return -ENODEV;
+ sbefifo = dev_get_drvdata(dev);
+ if (!sbefifo)
return -ENODEV;
if (WARN_ON_ONCE(sbefifo->magic != SBEFIFO_MAGIC))
return -ENODEV;