[PATCH 2/3] char: xilinx_hwicap: Drop if block with always false condition

Michal Simek michal.simek at amd.com
Mon Jun 5 02:24:26 PDT 2023



On 6/5/23 11:20, Uwe Kleine-König wrote:
> hwicap_drv_remove() is only called for a device after hwicap_drv_probe()
> returned 0. In that case dev_set_drvdata() was called (by hwicap_setup())
> with a non-NULL value and so dev_get_drvdata() won't return NULL.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>   drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index c4d75e684be6..87ece300b2ca 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -810,8 +810,6 @@ static int hwicap_drv_remove(struct platform_device *pdev)
>   	struct hwicap_drvdata *drvdata;
>   
>   	drvdata = dev_get_drvdata(dev);
> -	if (!drvdata)
> -		return 0;
>   
>   	device_destroy(icap_class, drvdata->devt);
>   	cdev_del(&drvdata->cdev);

Acked-by: Michal Simek <michal.simek at amd.com>

Thanks,
Michal



More information about the linux-arm-kernel mailing list