From patchwork Mon Mar 4 12:59:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10837789 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DEF11399 for ; Mon, 4 Mar 2019 13:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF1129CA4 for ; Mon, 4 Mar 2019 13:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5942329F8E; Mon, 4 Mar 2019 13:00:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 04B242A187 for ; Mon, 4 Mar 2019 13:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfCDNAG (ORCPT ); Mon, 4 Mar 2019 08:00:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:33910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbfCDNAF (ORCPT ); Mon, 4 Mar 2019 08:00:05 -0500 Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com [149.6.153.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2096E2075B; Mon, 4 Mar 2019 13:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551704405; bh=L30hQIbLwt9oWznlITAJ8HcQTffhpCXnWKp4fFVOaKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WA+VOg/JHdV89vsWC5e4zlz2P+xxpU+bB8QY/r2VWQSkkZJTxxgNAYt0vw9Byq7yI iJjyi4zu64mEg2lSrQpqYg/BV35ggTbDIjQANKXLqW0A+0bqjNVaWsY3ovSDeYVZ3z xHjF0RjvF6zBUkuMSBzGDwlBVv65swepK2E65b4c= From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, joe@perches.com, lorenzo.bianconi@redhat.com Subject: [PATCH v2] mt76: usb: reduce code indentation in mt76u_alloc_tx Date: Mon, 4 Mar 2019 13:59:49 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: 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 Improve code readability reducing code indentation in mt76u_alloc_tx Signed-off-by: Lorenzo Bianconi --- Changes since v1: - use devm_kcalloc instead of devm_kzalloc and get rid of size --- drivers/net/wireless/mediatek/mt76/usb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 4c1abd492405..508931101178 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -810,15 +810,14 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) if (!buf->urb) return -ENOMEM; - if (dev->usb.sg_en) { - size_t size = MT_SG_MAX_SIZE * - sizeof(struct scatterlist); - - buf->urb->sg = devm_kzalloc(dev->dev, size, - GFP_KERNEL); - if (!buf->urb->sg) - return -ENOMEM; - } + if (!dev->usb.sg_en) + continue; + + buf->urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE, + sizeof(struct scatterlist), + GFP_KERNEL); + if (!buf->urb->sg) + return -ENOMEM; } } return 0;