On Mon, Mar 01, 2021 at 07:56:11PM +0800, Jay Fang wrote: > +static int hisi_spi_setup(struct spi_device *spi) > +{ > + struct hisi_spi *hs = spi_controller_get_devdata(spi->controller); > + struct hisi_chip_data *chip; > + > + /* Only alloc on first setup */ > + chip = spi_get_ctldata(spi); > + if (!chip) { > + chip = kzalloc(sizeof(*chip), GFP_KERNEL); > + if (!chip) > + return -ENOMEM; > + spi_set_ctldata(spi, chip); > + } [...] > + master = devm_spi_alloc_master(dev, 0); It would seem simpler to just pass "sizeof struct hisi_chip_data" to devm_spi_alloc_master(), thus obviating the need to allocate it on first incocation of the ->setup hook. Thanks, Lukas