LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Zahari Doychev <zahari.doychev@linux.com>
To: ming.lei@canonical.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Cc: zahari.doychev@linux.com
Subject: [PATCH] drivers: base: fw: fix ret value when loading fw
Date: Mon,  9 Mar 2015 16:49:52 +0100	[thread overview]
Message-ID: <1425916192-31600-2-git-send-email-zahari.doychev@linux.com> (raw)
In-Reply-To: <1425916192-31600-1-git-send-email-zahari.doychev@linux.com>

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>
---
 drivers/base/firmware_class.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 6c5c9ed..9642e5f 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -920,6 +920,10 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
 	else if (!buf->data)
 		retval = -ENOMEM;
 
+	/* wait for completion was successful so return ok */
+	if (retval > 0)
+		retval = 0;
+
 	device_remove_file(f_dev, &dev_attr_loading);
 err_del_bin_attr:
 	device_remove_bin_file(f_dev, &firmware_attr_data);
-- 
2.3.0


  reply	other threads:[~2015-03-09 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 15:49 [PATCH] fix loading of firmware with user mode helper Zahari Doychev
2015-03-09 15:49 ` Zahari Doychev [this message]
2015-03-10  7:32   ` [PATCH] drivers: base: fw: fix ret value when loading fw Ming Lei
2015-03-10  9:45     ` [PATCH v2] " Zahari Doychev
2015-03-18  7:41       ` Zahari Doychev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425916192-31600-2-git-send-email-zahari.doychev@linux.com \
    --to=zahari.doychev@linux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --subject='Re: [PATCH] drivers: base: fw: fix ret value when loading fw' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).