On Fri, Oct 18, 2019 at 01:56:06PM +0100, Lee Jones wrote: > The current implementation abuses the platform 'id' mfd_cell member > to index into the correct resources entry. If we place all cells > into their numbered slots, we can cycle through all the cell entries > and only process the populated ones which avoids this behaviour. > > Signed-off-by: Lee Jones <lee.jo...@linaro.org> > --- > drivers/mfd/cs5535-mfd.c | 31 +++++++++++++------------------ > 1 file changed, 13 insertions(+), 18 deletions(-) > > diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c > index 2c47afc22d24..b01e5bb4ed03 100644 > --- a/drivers/mfd/cs5535-mfd.c > +++ b/drivers/mfd/cs5535-mfd.c > @@ -115,16 +110,16 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, > return err; > > /* fill in IO range for each cell; subdrivers handle the region */ > - for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) { > - int bar = cs5535_mfd_cells[i].id; > - struct resource *r = &cs5535_mfd_resources[bar]; > + for (i = 0; i < NR_BARS; i++) { > + struct mfd_cell *cell = &cs5535_mfd_cells[i]; > + struct resource *r = &cs5535_mfd_resources[i]; > > - r->flags = IORESOURCE_IO; > - r->start = pci_resource_start(pdev, bar); > - r->end = pci_resource_end(pdev, bar); > + if (!cell) > + continue;
cell will never be null. Should this be cell->num_resources instead? Daniel.