From: Dan Carpenter <dan.carpenter@oracle.com>
To: Glen Lee <glen.lee@atmel.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
austin.shin@atmel.com, linux-wireless@vger.kernel.org,
Nicolas.FERRE@atmel.com, adel.noureldin@atmel.com,
tony.cho@atmel.com, leo.kim@atmel.com, adham.abozaeid@atmel.com
Subject: Re: [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211
Date: Fri, 22 Jan 2016 11:27:14 +0300 [thread overview]
Message-ID: <20160122082714.GF5325@mwanda> (raw)
In-Reply-To: <1452584395-24910-25-git-send-email-glen.lee@atmel.com>
On Tue, Jan 12, 2016 at 04:39:53PM +0900, Glen Lee wrote:
> +static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
> +{
> + s32 ret = 0;
s32 should almost always be changed to int. Don't initialize variables
with bogus values. GCC has a helper warning for uninitialized variables
and this disables GCC's uninitialized variable checking.
> + struct wid wid;
> +
> + wid.id = (u16)WID_TX_POWER;
> + wid.type = WID_CHAR;
> + wid.val = (s8 *)&tx_pwr;
Casting an unsigned value from the user to signed seems like a recipe
for disaster.
> + wid.size = sizeof(char);
> +
> + ret = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
> + wilc_get_vif_idx(vif));
> + if(ret)
grumble grumble... checkpatch.
> + netdev_err(vif->ndev,"Failed to set TX PWR\n");
> +}
[ snip]
> +static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
> + enum nl80211_tx_power_setting type, int mbm)
> +{
> + int ret = 0;
No need.
> + s32 tx_power = MBM_TO_DBM(mbm);
> + struct wilc_priv *priv = wiphy_priv(wiphy);
> + struct wilc_vif *vif = netdev_priv(priv->dev);
> +
> + netdev_info(vif->ndev, "Setting tx power to %d\n", tx_power);
Remove this debug output.
> +
> + if(tx_power < 0)
grumble.
> + tx_power = 0;
> + else if(tx_power > 18)
> + tx_power = 18;
> + ret = wilc_set_tx_power(vif ,(u8)tx_power);
This cast is not needed. Whitespace grumble.
regards,
dan carpenter
next prev parent reply other threads:[~2016-01-22 8:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
2016-01-12 7:39 ` [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface Glen Lee
2016-01-12 7:39 ` [PATCH 02/26] staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT Glen Lee
2016-01-12 7:39 ` [PATCH 03/26] staging: wilc1000: support suspend/resume functionality Glen Lee
2016-01-12 7:39 ` [PATCH 04/26] staging: wilc1000: add sdio resume/suspend Glen Lee
2016-01-22 7:44 ` Dan Carpenter
2016-01-22 8:10 ` glen lee
2016-01-24 20:57 ` Greg KH
2016-01-12 7:39 ` [PATCH 05/26] staging: wilc1000: sdio_init: add resume argument Glen Lee
2016-01-12 7:39 ` [PATCH 06/26] staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211 Glen Lee
2016-01-12 7:39 ` [PATCH 07/26] staging: wilc1000: remove sleep and reduce close timeout Glen Lee
2016-01-12 7:39 ` [PATCH 08/26] staging: wilc1000: get address from wilc Glen Lee
2016-01-12 7:39 ` [PATCH 09/26] staging: wilc1000: use unified firmware Glen Lee
2016-01-12 23:18 ` Julian Calaby
2016-01-13 2:32 ` glen lee
2016-01-12 7:39 ` [PATCH 10/26] staging: wilc1000: remove wilc_set_machw_change_vir_if Glen Lee
2016-01-12 7:39 ` [PATCH 11/26] staging: wilc1000: set bssid with mode Glen Lee
2016-01-12 7:39 ` [PATCH 12/26] staging: wilc1000: set proper bssid address Glen Lee
2016-01-12 7:39 ` [PATCH 13/26] staging: wilc1000: change_virtual_intf: change codes for unified firmware Glen Lee
2016-01-12 7:39 ` [PATCH 14/26] staging: wilc1000: call power save after changing mode Glen Lee
2016-01-12 7:39 ` [PATCH 15/26] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index Glen Lee
2016-01-12 7:39 ` [PATCH 16/26] staging: wilc1000: remove unused functions Glen Lee
2016-01-12 7:39 ` [PATCH 17/26] staging: wilc1000: ignore power save Glen Lee
2016-01-12 7:39 ` [PATCH 18/26] staging: wilc1000: handle connecting error Glen Lee
2016-01-12 7:39 ` [PATCH 19/26] staging: wilc1000: tcp_process: fix a build warning Glen Lee
2016-01-12 7:39 ` [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER Glen Lee
2016-01-22 7:57 ` Dan Carpenter
2016-01-12 7:39 ` [PATCH 21/26] staging: wilc1000: increase link speed Glen Lee
2016-01-22 8:08 ` Dan Carpenter
2016-01-12 7:39 ` [PATCH 22/26] staging: wilc1000: disable power save when AP mode Glen Lee
2016-01-12 7:39 ` [PATCH 23/26] staging: wilc1000: fix bug on p2p connection Glen Lee
2016-01-12 7:39 ` [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211 Glen Lee
2016-01-22 8:27 ` Dan Carpenter [this message]
2016-01-12 7:39 ` [PATCH 25/26] staging: wilc1000: fix WEP security bug Glen Lee
2016-01-12 7:39 ` [PATCH 26/26] staging: wilc1000: get mac address after setting drv handler Glen Lee
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=20160122082714.GF5325@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Nicolas.FERRE@atmel.com \
--cc=adel.noureldin@atmel.com \
--cc=adham.abozaeid@atmel.com \
--cc=austin.shin@atmel.com \
--cc=devel@driverdev.osuosl.org \
--cc=glen.lee@atmel.com \
--cc=gregkh@linuxfoundation.org \
--cc=leo.kim@atmel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=tony.cho@atmel.com \
/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;
as well as URLs for NNTP newsgroup(s).