Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: Use of_device_get_match_data()

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220303092131.2060044-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Minghao Chi (CGEL ZTE) and committed by
Mark Brown
dc8fea13 13262fc2

+2 -4
+2 -4
drivers/spi/spi-npcm-fiu.c
··· 671 671 static int npcm_fiu_probe(struct platform_device *pdev) 672 672 { 673 673 const struct fiu_data *fiu_data_match; 674 - const struct of_device_id *match; 675 674 struct device *dev = &pdev->dev; 676 675 struct spi_controller *ctrl; 677 676 struct npcm_fiu_spi *fiu; ··· 684 685 685 686 fiu = spi_controller_get_devdata(ctrl); 686 687 687 - match = of_match_device(npcm_fiu_dt_ids, dev); 688 - if (!match || !match->data) { 688 + fiu_data_match = of_device_get_match_data(dev); 689 + if (!fiu_data_match) { 689 690 dev_err(dev, "No compatible OF match\n"); 690 691 return -ENODEV; 691 692 } 692 693 693 - fiu_data_match = match->data; 694 694 id = of_alias_get_id(dev->of_node, "fiu"); 695 695 if (id < 0 || id >= fiu_data_match->fiu_max) { 696 696 dev_err(dev, "Invalid platform device id: %d\n", id);