From: Nishka Dasgupta <nishkadg.linux@gmail.com>
To: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, straube.linux@gmail.com,
larry.finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
colin.king@canonical.com, valdis.kletnieks@vt.edu,
tiny.windzz@gmail.com
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Subject: [PATCH 1/2] staging: rtl8712: r8712_setdatarate_cmd(): Change
Date: Fri, 7 Jun 2019 19:36:57 +0530 [thread overview]
Message-ID: <20190607140658.11932-1-nishkadg.linux@gmail.com> (raw)
Change the return values of function r8712_setdatarate_cmd from _SUCCESS
and _FAIL to 0 and -ENOMEM respectively.
Change the return type of the function from u8 to int to reflect this.
Change the call site of the function to check for 0 instead of _SUCCESS.
(Checking that the return value != 0 is not necessary; the return value
itself can simply be passed into the conditional.)
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/rtl8712/rtl871x_cmd.c | 8 ++++----
drivers/staging/rtl8712/rtl871x_cmd.h | 2 +-
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 05a78ac24987..e478c031f95f 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -242,7 +242,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
return _SUCCESS;
}
-u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset)
+int r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset)
{
struct cmd_obj *ph2c;
struct setdatarate_parm *pbsetdataratepara;
@@ -250,18 +250,18 @@ u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset)
ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c)
- return _FAIL;
+ return -ENOMEM;
pbsetdataratepara = kmalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
if (!pbsetdataratepara) {
kfree(ph2c);
- return _FAIL;
+ return -ENOMEM;
}
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara,
GEN_CMD_CODE(_SetDataRate));
pbsetdataratepara->mac_id = 5;
memcpy(pbsetdataratepara->datarates, rateset, NumRates);
r8712_enqueue_cmd(pcmdpriv, ph2c);
- return _SUCCESS;
+ return 0;
}
u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan)
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h
index 262984c58efb..800216cca2f6 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -719,7 +719,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter,
u8 r8712_disassoc_cmd(struct _adapter *padapter);
u8 r8712_setopmode_cmd(struct _adapter *padapter,
enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
-u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset);
+int r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset);
u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan);
u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset);
u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval);
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index b424b8436fcf..761e2ba68a42 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1367,7 +1367,7 @@ static int r8711_wx_set_rate(struct net_device *dev,
datarates[i] = 0xff;
}
}
- if (r8712_setdatarate_cmd(padapter, datarates) != _SUCCESS)
+ if (r8712_setdatarate_cmd(padapter, datarates))
ret = -ENOMEM;
return ret;
}
--
2.19.1
next reply other threads:[~2019-06-07 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-07 14:06 Nishka Dasgupta [this message]
2019-06-07 14:06 ` [PATCH 2/2] staging: rtl8712: r8712_createbss_cmd(): Change Nishka Dasgupta
2019-06-07 14:18 ` Dan Carpenter
2019-06-07 14:15 ` [PATCH 1/2] staging: rtl8712: r8712_setdatarate_cmd(): Change Dan Carpenter
2019-06-10 4:32 ` Nishka Dasgupta
2019-06-10 14:33 ` Dan Carpenter
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=20190607140658.11932-1-nishkadg.linux@gmail.com \
--to=nishkadg.linux@gmail.com \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=larry.finger@lwfinger.net \
--cc=linux-kernel@vger.kernel.org \
--cc=straube.linux@gmail.com \
--cc=tiny.windzz@gmail.com \
--cc=valdis.kletnieks@vt.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox