From patchwork Fri Aug 4 08:14:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9880817 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D988560360 for ; Fri, 4 Aug 2017 08:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C480828979 for ; Fri, 4 Aug 2017 08:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7F49289B8; Fri, 4 Aug 2017 08:14:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6071528979 for ; Fri, 4 Aug 2017 08:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040AbdHDIOK (ORCPT ); Fri, 4 Aug 2017 04:14:10 -0400 Received: from smtprelay0222.hostedemail.com ([216.40.44.222]:46668 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751283AbdHDIOH (ORCPT ); Fri, 4 Aug 2017 04:14:07 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id B8CAB8D199; Fri, 4 Aug 2017 08:14:06 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: value73_40d4f7a250a1b X-Filterd-Recvd-Size: 4100 Received: from XPS-9350 (unknown [47.151.132.55]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Fri, 4 Aug 2017 08:14:05 +0000 (UTC) Message-ID: <1501834444.2106.5.camel@perches.com> Subject: Re: [PATCH] Staging: wilc1000: Fix line over 80 characters From: Joe Perches To: Himanshu Jha , gregkh@linuxfoundation.org Cc: aditya.shankar@microchip.com, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Date: Fri, 04 Aug 2017 01:14:04 -0700 In-Reply-To: <1501797622-1711-1-git-send-email-himanshujha199640@gmail.com> References: <1501797622-1711-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 2017-08-04 at 03:30 +0530, Himanshu Jha wrote: > This patch fixes 80 characters limit coding style issue. > > Signed-off-by: Himanshu Jha > --- > drivers/staging/wilc1000/linux_wlan.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c > index dbb3e24..5dab2cd 100644 > --- a/drivers/staging/wilc1000/linux_wlan.c > +++ b/drivers/staging/wilc1000/linux_wlan.c > @@ -1087,7 +1087,8 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) > > snprintf(buff, size, "rssi %d", rssi); > > - if (copy_to_user(wrq->u.data.pointer, buff, size)) { > + if (copy_to_user(wrq->u.data.pointer, buff, > + size)) { > netdev_err(ndev, "failed to copy\n"); > ret = -EFAULT; > goto done; Rather than just shut-up checkpatch, please try to improve the code. For instance, this function could be rewritten as: --- drivers/staging/wilc1000/linux_wlan.c | 51 +++++++++++++++-------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 119f3459b5bb..0d8371f76015 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1054,60 +1054,51 @@ static int wilc_mac_close(struct net_device *ndev) static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { - u8 *buff = NULL; - s8 rssi; - u32 size = 0; - struct wilc_vif *vif; s32 ret = 0; - struct wilc *wilc; - - vif = netdev_priv(ndev); - wilc = vif->wilc; + u8 *buff = NULL; + struct wilc_vif *vif = netdev_priv(ndev); + struct wilc *wilc = vif->wilc; if (!wilc->initialized) return 0; switch (cmd) { - case SIOCSIWPRIV: - { + case SIOCSIWPRIV: { struct iwreq *wrq = (struct iwreq *)req; + struct iw_point *data = &wrq->u.data; + u32 size = data->length; - size = wrq->u.data.length; + if (size && data->pointer) { + s8 rssi; - if (size && wrq->u.data.pointer) { - buff = memdup_user(wrq->u.data.pointer, - wrq->u.data.length); + buff = memdup_user(data->pointer, data->length); if (IS_ERR(buff)) return PTR_ERR(buff); - if (strncasecmp(buff, "RSSI", size) == 0) { - ret = wilc_get_rssi(vif, &rssi); - netdev_info(ndev, "RSSI :%d\n", rssi); + if (strncasecmp(buff, "RSSI", size) != 0) + break; + + ret = wilc_get_rssi(vif, &rssi); + netdev_info(ndev, "RSSI: %d\n", rssi); - rssi += 5; + rssi += 5; - snprintf(buff, size, "rssi %d", rssi); + snprintf(buff, size, "rssi %d", rssi); - if (copy_to_user(wrq->u.data.pointer, buff, size)) { - netdev_err(ndev, "failed to copy\n"); - ret = -EFAULT; - goto done; - } + if (copy_to_user(data->pointer, buff, size)) { + netdev_err(ndev, "failed to copy\n"); + ret = -EFAULT; } } + break; } - break; default: - { netdev_info(ndev, "Command - %d - has been received\n", cmd); ret = -EOPNOTSUPP; - goto done; - } + break; } -done: - kfree(buff); return ret;