drivers: base: fw: fix ret value when loading fw
authorZahari Doychev <zahari.doychev@linux.com>
Tue, 10 Mar 2015 09:45:40 +0000 (10:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2015 13:49:10 +0000 (14:49 +0100)
When using the user mode helper to load firmwares the function _request_firmware
gets a positive return value from fw_load_from_user_helper and because of this
the firmware buffer is not assigned. This happens only when the return value
is zero. This patch fixes this problem in _request_firmware_load. When the
completion is ready the return value is set to zero.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c

index 1b5bfd7cf6b656afab31100678183aa4230d842c..171841ad10089feef1aea6e6035327a68e745604 100644 (file)
@@ -919,6 +919,8 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
                mutex_lock(&fw_lock);
                fw_load_abort(fw_priv);
                mutex_unlock(&fw_lock);
+       } else if (retval > 0) {
+               retval = 0;
        }
 
        if (is_fw_load_aborted(buf))