Skip to content

Commit

Permalink
cfg80211: change function signature of cfg80211_get_p2p_attr()
Browse files Browse the repository at this point in the history
The function cfg80211_get_p2p_attr() can fail and returns
a negative error code. However, the return type is unsigned
int. The largest positive number is determined by desired_len
variable in the function, which is u16. So changing the return
type to int to allow easy error checking. Also change the type
for the attribute to enum for improved type checking.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
[fix indentation, don't use u8 attr variable]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Arend van Spriel authored and Johannes Berg committed Nov 26, 2012
1 parent 0172bb7 commit c216e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3652,8 +3652,9 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev);
* the data is malformed or the attribute can't be found (respectively),
* or the length of the found attribute (which can be zero).
*/
unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
u8 attr, u8 *buf, unsigned int bufsize);
int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
enum ieee80211_p2p_attr_id attr,
u8 *buf, unsigned int bufsize);

/* Logging, debugging and troubleshooting/diagnostic helpers. */

Expand Down
5 changes: 3 additions & 2 deletions net/wireless/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,9 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate)
}
EXPORT_SYMBOL(cfg80211_calculate_bitrate);

unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
u8 attr, u8 *buf, unsigned int bufsize)
int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
enum ieee80211_p2p_attr_id attr,
u8 *buf, unsigned int bufsize)
{
u8 *out = buf;
u16 attr_remaining = 0;
Expand Down

0 comments on commit c216e64

Please sign in to comment.