summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2022-08-11 00:06:49 +0200
committerTudor Ambarus <tudor.ambarus@microchip.com>2022-11-21 15:37:15 +0200
commit0d9270f2762b8a2bd0df7c4a2e7e651703783793 (patch)
treec9ebe22b8977061f672f22d8059bbe818b258ec5 /drivers/mtd
parent7d388551b6888f3725e6c957f472526b35161a5b (diff)
downloadlinux-0d9270f2762b8a2bd0df7c4a2e7e651703783793.tar.bz2
mtd: spi-nor: sysfs: hide manufacturer if it is not set
The manufacturer may be optional when pure SFDP flashes are supported. Hide the sysfs property if no manufacturer is set. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Link: https://lore.kernel.org/r/20220810220654.1297699-3-michael@walle.cc
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c
index 4c3b351aef24..20563c1926f4 100644
--- a/drivers/mtd/spi-nor/sysfs.c
+++ b/drivers/mtd/spi-nor/sysfs.c
@@ -74,6 +74,8 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
struct spi_mem *spimem = spi_get_drvdata(spi);
struct spi_nor *nor = spi_mem_get_drvdata(spimem);
+ if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer)
+ return 0;
if (attr == &dev_attr_jedec_id.attr && !nor->info->id_len)
return 0;