[PATCH] dmaengine: mxs-dma: Add check for dma_set_max_seg_size()

Vinod Koul vkoul at kernel.org
Thu Apr 25 02:04:13 PDT 2024


On 24-04-24, 00:07, Frank Li wrote:
> On Tue, Apr 23, 2024 at 10:32:05PM +0800, Ma Ke wrote:

> > -	dma_set_max_seg_size(mxs_dma->dma_device.dev, MAX_XFER_BYTES);
> > +	ret = dma_set_max_seg_size(mxs_dma->dma_device.dev, MAX_XFER_BYTES);
> > +	if (ret)
> > +		return ret;
> 
> How error happen? 
> 
> static inline int dma_set_max_seg_size(struct device *dev, unsigned int size)
> {
> 	if (dev->dma_parms) {
> 		dev->dma_parms->max_segment_size = size;
> 		return 0;
> 	}
> 	return -EIO;
> }
> 
> Only possible dev->dma_parms is null. but mxs-dma is platform device, it
> point to platform's dma_parms field. Look like impossible it is null.

Yep, checking for the sake of checking is bad. It needs to be logical

-- 
~Vinod



More information about the linux-arm-kernel mailing list