[OPW,kernel] staging: rtl8188eu: os_dep: Used min_t instead of min
diff mbox

Message ID 1414631026-8514-1-git-send-email-gulsah.1004@gmail.com
State New, archived
Headers show

Commit Message

Gulsah Kose Oct. 30, 2014, 1:03 a.m. UTC
This patch fixes this checkpatch.pl warning:
WARNING: min() should probably be min_t(int, req->essid_len,
IW_ESSID_MAX_SIZE)

by using this coccinelle script:

@r@
identifier i;
expression e1, e2;
type t1, t2;
@@

t1 i =
- min((t2)e1, e2);
+ min_t(t2, e1, e2);

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Baluta Oct. 30, 2014, 9:12 a.m. UTC | #1
On Thu, Oct 30, 2014 at 3:03 AM, Gulsah Kose <gulsah.1004@gmail.com> wrote:
> This patch fixes this checkpatch.pl warning:
> WARNING: min() should probably be min_t(int, req->essid_len,
> IW_ESSID_MAX_SIZE)
>
> by using this coccinelle script:
>
> @r@
> identifier i;
> expression e1, e2;
> type t1, t2;
> @@
>
> t1 i =
> - min((t2)e1, e2);
> + min_t(t2, e1, e2);
>
> Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>

Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>

Patch
diff mbox

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index d598fec..22b27a9 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1136,7 +1136,8 @@  static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 		struct iw_scan_req *req = (struct iw_scan_req *)extra;
 
 		if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
-			int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE);
+			int len = min_t(int, req->essid_len,
+					IW_ESSID_MAX_SIZE);
 
 			memcpy(ssid[0].Ssid, req->essid, len);
 			ssid[0].SsidLength = len;