[PATCH 1/1] usb: xhci: avoid type conversion of void *

Marek Vasut marex at denx.de
Tue Sep 29 22:20:49 CEST 2020


On 9/29/20 10:03 PM, Heinrich Schuchardt wrote:
> void * can be assigned to any pointer variable. Avoid unnecessary
> conversions.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  drivers/usb/host/xhci-mem.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> 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));

As far as I remember, the compiler used to complain about assignment
from a different type without a cast ?

btw. you might also do a patch which does malloc(sizeof(*seg)); while at it.


More information about the U-Boot mailing list