Re: [PATCH] ata: pata_ep93xx: fix double-free of DMA channel on error path

"Arnd Bergmann" <[email protected]> Wed, 08 Jul 2026 12:50:11 +0200
Newsgroups org.kernel.vger.linux-ide,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Jul 8, 2026, at 11:27, Chen Changcheng wrote:
>  static void ep93xx_pata_release_dma(struct ep93xx_pata_data *drv_data)
>  {
> -	if (drv_data->dma_rx_channel) {
> +	if (!IS_ERR_OR_NULL(drv_data->dma_rx_channel)) {
>  		dma_release_channel(drv_data->dma_rx_channel);
>  		drv_data->dma_rx_channel = NULL;
>  	}

If something requires you to use IS_ERR_OR_NULL(), that is usually
a bad API design, and you should fix this at the place where
it gets introduced.

Please fix the probe path instead so it doesn't try to use the
device without a valid channel.

      Arnd