Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275263 > unrolled thread

[PATCH char-misc-next 2/4] misc: mic: return error properly

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-11-23 13:00 +0100
Last post2015-11-23 13:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH char-misc-next 2/4] misc: mic: return error properly Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-23 13:00 +0100

#1275263 — [PATCH char-misc-next 2/4] misc: mic: return error properly

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-11-23 13:00 +0100
Subject[PATCH char-misc-next 2/4] misc: mic: return error properly
Message-ID<qxXWP-1fN-29@gated-at.bofh.it>
If request_firmware() succeeds then rc becomes 0. After that if the test
for strcmp() fails then we were jumping to label done: and returning rc.
But rc being 0 we returned success whereas we have failed here and we
were supposed to return an error.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

I am not sure if this was intentional. Another case might be that if the
string bootmode is "flash" then mic_x100_load_command_line() was
intentionally skipped and success was returned.

 drivers/misc/mic/host/mic_x100.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c
index cd5208d..317e25f 100644
--- a/drivers/misc/mic/host/mic_x100.c
+++ b/drivers/misc/mic/host/mic_x100.c
@@ -468,8 +468,13 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf)
 	}
 	memcpy_toio(mdev->aper.va + mdev->bootaddr, fw->data, fw->size);
 	mdev->ops->write_spad(mdev, MIC_X100_FW_SIZE, fw->size);
-	if (!strcmp(mdev->cosm_dev->bootmode, "flash"))
+	if (!strcmp(mdev->cosm_dev->bootmode, "flash")) {
+		rc = -EINVAL;
+		dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
+			__func__, __LINE__, rc);
+		release_firmware(fw);
 		goto done;
+	}
 	/* load command line */
 	rc = mic_x100_load_command_line(mdev, fw);
 	if (rc) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web