diff options
| author | Miquel Raynal <[email protected]> | 2022-01-27 11:06:31 +0000 |
|---|---|---|
| committer | Miquel Raynal <[email protected]> | 2022-01-31 16:18:03 +0000 |
| commit | 3f26d1bf90ba9bf420e49ec9cdbe13d15c0df7cd (patch) | |
| tree | 5cf5dec3b435f9b286b3c862c351cc46dfb5c98e /drivers/mtd/nand/raw/atmel/nand-controller.c | |
| parent | mtd_blkdevs: avoid soft lockups with some mtd/spi devices (diff) | |
| download | kernel-3f26d1bf90ba9bf420e49ec9cdbe13d15c0df7cd.tar.gz kernel-3f26d1bf90ba9bf420e49ec9cdbe13d15c0df7cd.zip | |
mtd: Fix misuses of of_match_ptr()
of_match_ptr() either expands to NULL if !CONFIG_OF, or is transparent
otherwise. There are several drivers using this macro which keep their
of_device_id array enclosed within an #ifdef CONFIG_OF check, these are
considered fine. However, When misused, the of_device_id array pointed
by this macro will produce a warning because it is finally unused when
compiled without OF support.
A number of fixes are possible:
- Always depend on CONFIG_OF, but this will not always work and may
break boards.
- Enclose the compatible array by #ifdef's, this may save a bit of
memory but will reduce build coverage.
- Tell the compiler the array may be unused, if this can be avoided,
let's not do this.
- Just drop the macro, setting the of_device_id array for a non OF
enabled platform is not an issue, it will just be unused.
The latter solution seems the more appropriate, so let's use it.
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Acked-by: Paul Cercueil <[email protected]>
Reviewed-by: Alexandre Belloni <[email protected]>
Acked-by: Pratyush Yadav <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
Diffstat (limited to 'drivers/mtd/nand/raw/atmel/nand-controller.c')
| -rw-r--r-- | drivers/mtd/nand/raw/atmel/nand-controller.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index f3276ee9e4fe..4ecbaccf5526 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -2648,7 +2648,7 @@ static SIMPLE_DEV_PM_OPS(atmel_nand_controller_pm_ops, NULL, static struct platform_driver atmel_nand_controller_driver = { .driver = { .name = "atmel-nand-controller", - .of_match_table = of_match_ptr(atmel_nand_controller_of_ids), + .of_match_table = atmel_nand_controller_of_ids, .pm = &atmel_nand_controller_pm_ops, }, .probe = atmel_nand_controller_probe, |
