From patchwork Tue Sep 29 20:03:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1373648 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=RndT6jNP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C19LD1zscz9sPB for ; Wed, 30 Sep 2020 06:03:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 023F88174F; Tue, 29 Sep 2020 22:03:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="RndT6jNP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4DCB881996; Tue, 29 Sep 2020 22:03:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9B11C8158B for ; Tue, 29 Sep 2020 22:03:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1601409785; bh=KSlnV3XBClnlhEhQu8aWG+R2Rz6qNbkIlqGyX8PrZYY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=RndT6jNP37aMYoRZcGkg6AmTSCYwlW1OUa70/c1j0iYlMOmfUw11RTGzqFaUtQL1X El4xj9fMX8j0zNr6NkGozHJYzojaFGRxYm1FojgM9axomSlLS8w7XW9k0QG8o3GVnR OCKc+W6LiWBibcSEVw8HAVhvYENDEQNicrXlfMa4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MZkpR-1jsuuU2pqZ-00WqBR; Tue, 29 Sep 2020 22:03:05 +0200 From: Heinrich Schuchardt To: Bin Meng Cc: Marek Vasut , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] usb: xhci: avoid type conversion of void * Date: Tue, 29 Sep 2020 22:03:01 +0200 Message-Id: <20200929200301.66459-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:Wl/61XRH7qBmVnWghJmOd1vO8/XPEXmbfEv9BEV+1x3qDT/99PR ogGRO8Bt20sMyatr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7S+ qdlPHCFMfPt8D5lAT2iwBuDGA+w9DnMiT67uG2/0ZbYVJdYlsQqHO2vTfxRBvIY4C+fidnwHS y4ZCxSPwZFBkFYRvt508qQZlOn9mfA0vT1Az3isvb5q4Po1q00EutFpEC5VYxU0xD9apICLh6 wlMgbkJMV0Wn4lL94VooCfj3maqSgqgitFVSAhjzF0dwHaAtbiyDcHDoiPkw9dqsUG/c1DxqW tO1w28d1wcfwboYL1/cNPRoqhUOrLn48dZBrhMC638IRWvxrjD1UuzCKfMEmxbTyRWcCX0bwW 9TnkpHm6WG8r4V5TJn8PEo7fTEWngIyVr7FiwdOcaK3Ig3n1aVUbhPI9FxmPrGK5BFNfqjJ7G mkHzJA5qgJ/r/BvAzOEU6s1yPSPq65z5qAsGD5A== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean void * can be assigned to any pointer variable. Avoid unnecessary conversions. Signed-off-by: Heinrich Schuchardt Reviewed-by: Bin Meng --- drivers/usb/host/xhci-mem.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.28.0 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1da0524aa0..4c303ae705 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -280,10 +280,10 @@ static struct xhci_segment *xhci_segment_alloc(void) { struct xhci_segment *seg; - seg = (struct xhci_segment *)malloc(sizeof(struct xhci_segment)); + seg = malloc(sizeof(struct xhci_segment)); BUG_ON(!seg); - seg->trbs = (union xhci_trb *)xhci_malloc(SEGMENT_SIZE); + seg->trbs = xhci_malloc(SEGMENT_SIZE); seg->next = NULL; @@ -310,7 +310,7 @@ struct xhci_ring *xhci_ring_alloc(unsigned int num_segs, bool link_trbs) struct xhci_ring *ring; struct xhci_segment *prev; - ring = (struct xhci_ring *)malloc(sizeof(struct xhci_ring)); + ring = malloc(sizeof(struct xhci_ring)); BUG_ON(!ring); if (num_segs == 0) @@ -426,8 +426,7 @@ static struct xhci_container_ctx { struct xhci_container_ctx *ctx; - ctx = (struct xhci_container_ctx *) - malloc(sizeof(struct xhci_container_ctx)); + ctx = malloc(sizeof(struct xhci_container_ctx)); BUG_ON(!ctx); BUG_ON((type != XHCI_CTX_TYPE_DEVICE) && (type != XHCI_CTX_TYPE_INPUT)); @@ -437,7 +436,7 @@ static struct xhci_container_ctx if (type == XHCI_CTX_TYPE_INPUT) ctx->size += CTX_SIZE(readl(&ctrl->hccr->cr_hccparams)); - ctx->bytes = (u8 *)xhci_malloc(ctx->size); + ctx->bytes = xhci_malloc(ctx->size); return ctx; } @@ -459,8 +458,7 @@ int xhci_alloc_virt_device(struct xhci_ctrl *ctrl, unsigned int slot_id) return -EEXIST; } - ctrl->devs[slot_id] = (struct xhci_virt_device *) - malloc(sizeof(struct xhci_virt_device)); + ctrl->devs[slot_id] = malloc(sizeof(struct xhci_virt_device)); if (!ctrl->devs[slot_id]) { puts("Failed to allocate virtual device\n"); @@ -519,8 +517,7 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr, struct xhci_segment *seg; /* DCBAA initialization */ - ctrl->dcbaa = (struct xhci_device_context_array *) - xhci_malloc(sizeof(struct xhci_device_context_array)); + ctrl->dcbaa = xhci_malloc(sizeof(struct xhci_device_context_array)); if (ctrl->dcbaa == NULL) { puts("unable to allocate DCBA\n"); return -ENOMEM; @@ -556,8 +553,8 @@ int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr, /* Event ring does not maintain link TRB */ ctrl->event_ring = xhci_ring_alloc(ERST_NUM_SEGS, false); - ctrl->erst.entries = (struct xhci_erst_entry *) - xhci_malloc(sizeof(struct xhci_erst_entry) * ERST_NUM_SEGS); + ctrl->erst.entries = xhci_malloc(sizeof(struct xhci_erst_entry) * + ERST_NUM_SEGS); ctrl->erst.num_entries = ERST_NUM_SEGS;