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

From: Vinod Koul
Date: Thu Apr 25 2024 - 05:05:15 EST


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