Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Brugger <mbrugger@suse.com>2019-01-10 19:12:26 +0100
committerMatthias Brugger <mbrugger@suse.com>2019-01-11 11:40:39 +0100
commitb1230ddd538c1c4f7e2f84dbdb478b9aafc5197a (patch)
tree741e1c49402df39e2a585f5aeae23ab22a8aadb5
parente29e6e3d4ba1fad7b2e4a118377fe33ad0e2c016 (diff)
brcmfmac: Remove firmware-loading code duplication
-rw-r--r--patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch110
-rw-r--r--series.conf1
2 files changed, 111 insertions, 0 deletions
diff --git a/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch b/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
new file mode 100644
index 0000000000..b3e23f3e3f
--- /dev/null
+++ b/patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
@@ -0,0 +1,110 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:00:58 +0200
+Subject: brcmfmac: Remove firmware-loading code duplication
+Git-commit: a1a3b762163868ad07a4499a73df324f40d5ab0b
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+brcmf_fw_request_next_item and brcmf_fw_request_done both have identical
+code to complete the fw-request depending on the item-type.
+
+This commit adds a new brcmf_fw_complete_request helper removing this code
+duplication.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/firmware.c | 62 +++++++++----------
+ 1 file changed, 31 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+index 9095b830ae4d..784c84f0e9e7 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+@@ -504,6 +504,34 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
+ return -ENOENT;
+ }
+
++static int brcmf_fw_complete_request(const struct firmware *fw,
++ struct brcmf_fw *fwctx)
++{
++ struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos];
++ int ret = 0;
++
++ brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, fw ? "" : "not ");
++
++ switch (cur->type) {
++ case BRCMF_FW_TYPE_NVRAM:
++ ret = brcmf_fw_request_nvram_done(fw, fwctx);
++ break;
++ case BRCMF_FW_TYPE_BINARY:
++ if (fw)
++ cur->binary = fw;
++ else
++ ret = -ENOENT;
++ break;
++ default:
++ /* something fishy here so bail out early */
++ brcmf_err("unknown fw type: %d\n", cur->type);
++ release_firmware(fw);
++ ret = -EINVAL;
++ }
++
++ return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
++}
++
+ static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
+ {
+ struct brcmf_fw_item *cur;
+@@ -525,15 +553,7 @@ static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
+ if (ret < 0) {
+ brcmf_fw_request_done(NULL, fwctx);
+ } else if (!async && fw) {
+- brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path,
+- fw ? "" : "not ");
+- if (cur->type == BRCMF_FW_TYPE_BINARY)
+- cur->binary = fw;
+- else if (cur->type == BRCMF_FW_TYPE_NVRAM)
+- brcmf_fw_request_nvram_done(fw, fwctx);
+- else
+- release_firmware(fw);
+-
++ brcmf_fw_complete_request(fw, fwctx);
+ return -EAGAIN;
+ }
+ return 0;
+@@ -547,28 +567,8 @@ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
+
+ cur = &fwctx->req->items[fwctx->curpos];
+
+- brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path,
+- fw ? "" : "not ");
+-
+- if (!fw)
+- ret = -ENOENT;
+-
+- switch (cur->type) {
+- case BRCMF_FW_TYPE_NVRAM:
+- ret = brcmf_fw_request_nvram_done(fw, fwctx);
+- break;
+- case BRCMF_FW_TYPE_BINARY:
+- cur->binary = fw;
+- break;
+- default:
+- /* something fishy here so bail out early */
+- brcmf_err("unknown fw type: %d\n", cur->type);
+- release_firmware(fw);
+- ret = -EINVAL;
+- goto fail;
+- }
+-
+- if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL))
++ ret = brcmf_fw_complete_request(fw, fwctx);
++ if (ret < 0)
+ goto fail;
+
+ do {
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 1361fb6ddb..11c454a1da 100644
--- a/series.conf
+++ b/series.conf
@@ -41791,6 +41791,7 @@
patches.drivers/bnx2x-Add-MBI-version-to-ethtool-driver-query-output.patch
patches.drivers/bnx2x-Add-storm-FW-version-to-ethtool-driver-query-o.patch
patches.drivers/can-flexcan-flexcan_irq-fix-indention.patch
+ patches.drivers/0001-brcmfmac-Remove-firmware-loading-code-duplication.patch
patches.drivers/wlcore-Fix-the-return-value-in-case-of-error-in-wlco.patch
patches.drivers/rtl8xxxu-Fix-missing-break-in-switch.patch
patches.drivers/wireless-airo-potential-buffer-overflow-in-sprintf.patch