]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
misc: mic: return error properly
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Mon, 23 Nov 2015 11:54:30 +0000 (17:24 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 06:53:40 +0000 (22:53 -0800)
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>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/host/mic_x100.c

index cd5208d1895d96e82ccb50e41d365d8c8fd430b0..317e25ff484ce4ee1b914b8f246730758a2d8282 100644 (file)
@@ -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) {