Re: [PATCH] coresight: Use devm_bitmap_zalloc when applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2021-10-23 at 21:24 +0200, Christophe JAILLET wrote:
> 'drvdata->chs.guaranteed' is a bitmap. So use 'devm_bitmap_kzalloc()' to
> simplify code, improve the semantic and avoid some open-coded arithmetic
> in allocator arguments.
[]
> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
[]
> @@ -862,7 +862,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct stm_drvdata *drvdata;
>  	struct resource *res = &adev->res;
>  	struct resource ch_res;
> -	size_t bitmap_size;
>  	struct coresight_desc desc = { 0 };
>  
>  	desc.name = coresight_alloc_device_name(&stm_devs, dev);
> @@ -904,9 +903,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  	else
>  		drvdata->numsp = stm_num_stimulus_port(drvdata);
>  
> -	bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);
> -
> -	guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
> +	guaranteed = devm_bitmap_zalloc(dev, drvdata->numsp, GFP_KERNEL);
>  	if (!guaranteed)
>  		return -ENOMEM;
>  	drvdata->chs.guaranteed = guaranteed;

guaranteed is also pretty useless






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux