- 11 Jun, 2021 14 commits
-
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610022416.15291-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610022239.15238-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610022100.15185-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610021400.15132-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610021201.15076-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610020958.15023-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610020620.14970-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610020130.14917-1-thunder.leizhen@huawei.com
-
Zhen Lei authored
Fixes scripts/checkpatch.pl warning: WARNING: Possible unnecessary 'out of memory' message Remove it can help us save a bit of memory. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210610015052.14864-1-thunder.leizhen@huawei.com
-
Heiko Schocher authored
The Microchip 48l640 is a 8KByte EERAM connected via SPI. Signed-off-by:
Heiko Schocher <hs@denx.de> Tested-by:
Fabio Estevam <festevam@denx.de> Reported-by:
kernel test robot <lkp@intel.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210607033909.1424605-3-hs@denx.de
-
Heiko Schocher authored
The Microchip 48l640 is a 8KByte EERAM connected via SPI. Add devicetree bindings documentation. Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Heiko Schocher <hs@denx.de> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210607033909.1424605-2-hs@denx.de
-
Zhen Lei authored
Use MTD_DEVICE_ATTR_RO/RW() helper macros instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210603125323.12142-3-thunder.leizhen@huawei.com
-
Zhen Lei authored
Compared with the definition of DEVICE_ATTR_RO/RW(), the read and write function names of the sysfs attribute have an additional "mtd_" prefix. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210603125323.12142-2-thunder.leizhen@huawei.com
-
Zhen Lei authored
Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by:
Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210603123041.12036-1-thunder.leizhen@huawei.com
-
- 26 May, 2021 6 commits
-
-
Ansuel Smith authored
Add cleanup function as the name variable for the partition name was allocaed but never freed after the use as the add mtd function duplicate the name and free the pparts struct as the partition name is assumed to be static. The leak was found using kmemleak. Fixes: 803eb124 ("mtd: parsers: Add Qcom SMEM parser") Signed-off-by:
Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by:
Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210525230931.30013-1-ansuelsmth@gmail.com
-
Corentin Labbe authored
This patch fixes easy checkpatch issues. Signed-off-by:
Corentin Labbe <clabbe@baylibre.com> Reviewed-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210520114851.1274609-2-clabbe@baylibre.com
-
Corentin Labbe authored
fis-index-block is seeked in the master node and not in the partitions node. For following binding and current usage, the driver need to check the partitions subnode. Fixes: c0e118c8 ("mtd: partitions: Add OF support to RedBoot partitions") Signed-off-by:
Corentin Labbe <clabbe@baylibre.com> Reviewed-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210520114851.1274609-1-clabbe@baylibre.com
-
Ding Senjie authored
Remove superfluous "break", as there is a "return" before it. Signed-off-by:
Ding Senjie <dingsenjie@yulong.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210514124451.20352-1-dingsenjie@163.com
-
Dan Carpenter authored
If kmalloc() fails then it could lead to a NULL dereference. Check and return -ENOMEM on error. Fixes: 4b361cfa ("mtd: core: add OTP nvmem provider support") Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by:
Michael Walle <michael@walle.cc> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/YJ6Iw3iNvGycAWV6@mwanda
-
Jon Hunter authored
Commit 4b361cfa ("mtd: core: add OTP nvmem provider support") is causing the following panic ... ------------[ cut here ]------------ kernel BUG at /local/workdir/tegra/linux_next/kernel/mm/slab.c:2730! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM Modules linked in: CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.13.0-rc2-next-20210518 #1 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) PC is at ___cache_free+0x3f8/0x51c ... [<c029bb1c>] (___cache_free) from [<c029c658>] (kfree+0xac/0x1bc) [<c029c658>] (kfree) from [<c06da094>] (mtd_otp_size+0xc4/0x108) [<c06da094>] (mtd_otp_size) from [<c06dc864>] (mtd_device_parse_register+0xe4/0x2b4) [<c06dc864>] (mtd_device_parse_register) from [<c06e3ccc>] (spi_nor_probe+0x210/0x2c0) [<c06e3ccc>] (spi_nor_probe) from [<c06e9578>] (spi_probe+0x88/0xac) [<c06e9578>] (spi_probe) from [<c066891c>] (really_probe+0x214/0x3a4) [<c066891c>] (really_probe) from [<c0668b14>] (driver_probe_device+0x68/0xc0) [<c0668b14>] (driver_probe_device) from [<c0666cf8>] (bus_for_each_drv+0x5c/0xbc) [<c0666cf8>] (bus_for_each_drv) from [<c0668694>] (__device_attach+0xe4/0x150) [<c0668694>] (__device_attach) from [<c06679e0>] (bus_probe_device+0x84/0x8c) [<c06679e0>] (bus_probe_device) from [<c06657f8>] (device_add+0x48c/0x868) [<c06657f8>] (device_add) from [<c06eb784>] (spi_add_device+0xa0/0x168) [<c06eb784>] (spi_add_device) from [<c06ec9a8>] (spi_register_controller+0x8b8/0xb38) [<c06ec9a8>] (spi_register_controller) from [<c06ecc3c>] (devm_spi_register_controller+0x14/0x50) [<c06ecc3c>] (devm_spi_register_controller) from [<c06f0510>] (tegra_spi_probe+0x33c/0x450) [<c06f0510>] (tegra_spi_probe) from [<c066abec>] (platform_probe+0x5c/0xb8) [<c066abec>] (platform_probe) from [<c066891c>] (really_probe+0x214/0x3a4) [<c066891c>] (really_probe) from [<c0668b14>] (driver_probe_device+0x68/0xc0) [<c0668b14>] (driver_probe_device) from [<c0668e30>] (device_driver_attach+0x58/0x60) [<c0668e30>] (device_driver_attach) from [<c0668eb8>] (__driver_attach+0x80/0xc8) [<c0668eb8>] (__driver_attach) from [<c0666c48>] (bus_for_each_dev+0x78/0xb8) [<c0666c48>] (bus_for_each_dev) from [<c0667c44>] (bus_add_driver+0x164/0x1e8) [<c0667c44>] (bus_add_driver) from [<c066997c>] (driver_register+0x7c/0x114) [<c066997c>] (driver_register) from [<c010223c>] (do_one_initcall+0x50/0x2b0) [<c010223c>] (do_one_initcall) from [<c11011f0>] (kernel_init_freeable+0x1a8/0x1fc) [<c11011f0>] (kernel_init_freeable) from [<c0c09190>] (kernel_init+0x8/0x118) [<c0c09190>] (kernel_init) from [<c01001b0>] (ret_from_fork+0x14/0x24) ... ---[ end trace 0f652dd222de75d7 ]--- In the function mtd_otp_size() a buffer is allocated by calling kmalloc() and a pointer to the buffer is stored in a variable 'info'. The pointer 'info' may then be incremented depending on the length returned from mtd_get_user/fact_prot_info(). If 'info' is incremented, when kfree() is called to free the buffer the above panic occurs because we are no longer passing the original address of the buffer allocated. Fix this by indexing through the buffer allocated to avoid incrementing the pointer. Fixes: 4b361cfa ("mtd: core: add OTP nvmem provider support") Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Reviewed-by:
Michael Walle <michael@walle.cc> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210518185503.162787-1-jonathanh@nvidia.com
-
- 10 May, 2021 19 commits
-
-
Shubhankar Kuranagatti authored
A star has been added to subsequent line of block comment The closing */ has been shifted to new line This is done to maintain code uniformity Signed-off-by:
Shubhankar Kuranagatti <shubhankarvk@gmail.com> [<miquel.raynal@bootlin.com>: Fixed the title] Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210504062059.mywqzwveyjfawreg@kewl-virtual-machine
-
Petr Malat authored
Partname and partid are set by the upper driver (spi-nor) on the master MTD. If this MTD is partitioned and CONFIG_MTD_PARTITIONED_MASTER is disabled, the master MTD is not instantiated and partname and partid aren't available to the userspace. Always read the partname and partid from the master MTD, they describe the HW, which can't differ between master and its children. Signed-off-by:
Petr Malat <oss@malat.biz> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210430065057.32018-1-oss@malat.biz
-
Yang Li authored
Variable 'err' is set to 0 but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed. Cleans up the following clang-analyzer warning: drivers/mtd/tests/torturetest.c:233:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] Reported-by:
Abaci Robot <abaci@linux.alibaba.com> Signed-off-by:
Yang Li <yang.lee@linux.alibaba.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1619604142-119891-1-git-send-email-yang.lee@linux.alibaba.com
-
Yang Li authored
The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed. Using the correct error code is more intuitive Smatch tool warning: drivers/mtd/inftlmount.c:333 check_free_sectors() warn: returning -1 instead of -ENOMEM is sloppy drivers/mtd/nftlmount.c:272 check_free_sectors() warn: returning -1 instead of -ENOMEM is sloppy No functional change, just more standardized. Reported-by:
Abaci Robot <abaci@linux.alibaba.com> Signed-off-by:
Yang Li <yang.lee@linux.alibaba.com> [<miquel.raynal@bootlin.com>: Fixed the title] Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1619429543-52234-1-git-send-email-yang.lee@linux.alibaba.com
-
Jiapeng Chong authored
Variable err is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed. Cleans up the following clang-analyzer warning: drivers/mtd/tests/oobtest.c:626:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. drivers/mtd/tests/oobtest.c:603:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. drivers/mtd/tests/oobtest.c:579:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. drivers/mtd/tests/oobtest.c:556:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. drivers/mtd/tests/oobtest.c:532:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. drivers/mtd/tests/oobtest.c:509:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]. Reported-by:
Abaci Robot <abaci@linux.alibaba.com> Signed-off-by:
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1619346498-43617-1-git-send-email-jiapeng.chong@linux.alibaba.com
-
Michael Walle authored
Flash OTP regions can already be read via user space. Some boards have their serial number or MAC addresses stored in the OTP regions. Add support for them being a (read-only) nvmem provider. The API to read the OTP data is already in place. It distinguishes between factory and user OTP, thus there are up to two different providers. Signed-off-by:
Michael Walle <michael@walle.cc> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-6-michael@walle.cc
-
Michael Walle authored
SPI-NOR flashes may have OTP regions and have a nvmem binding. This binding is described in mtd.yaml. Signed-off-by:
Michael Walle <michael@walle.cc> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-5-michael@walle.cc
-
Michael Walle authored
Flash devices can have one-time-programmable regions. Add a nvmem binding so they can be used as a nvmem provider. Signed-off-by:
Michael Walle <michael@walle.cc> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-4-michael@walle.cc
-
Michael Walle authored
Convert MTD's common.txt to mtd.yaml. Signed-off-by:
Michael Walle <michael@walle.cc> Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-3-michael@walle.cc
-
Michael Walle authored
Until now, the of_node of the parent device is used. Some devices provide more than just the nvmem provider. To avoid name space clashes, add a way to allow specifying the nvmem cells in subnodes. Consider the following example: flash@0 { compatible = "jedec,spi-nor"; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { reg = <0x000000 0x010000>; }; }; otp { compatible = "user-otp"; #address-cells = <1>; #size-cells = <1>; serial-number@0 { reg = <0x0 0x8>; }; }; }; There the nvmem provider might be the MTD partition or the OTP region of the flash. Add a new config->of_node parameter, which if set, will be used instead of the parent's of_node. Signed-off-by:
Michael Walle <michael@walle.cc> Acked-by:
Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-2-michael@walle.cc
-
Hauke Mehrtens authored
Buffalo uses the TRX partition format also on Mediatek MT7622 SoCs. Signed-off-by:
Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-4-hauke@hauke-m.de
-
Hauke Mehrtens authored
Buffalo uses a different TRX magic for every device, to be able to use this trx parser, make it possible to specify the TRX magic in device tree. If no TRX magic is specified in device tree, the standard value will be used. This value should only be specified if a vendor chooses to use a non standard TRX magic. Signed-off-by:
Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-3-hauke@hauke-m.de
-
Hauke Mehrtens authored
This adds the description of an additional property which allows to specify a custom partition parser magic to detect a trx partition. Buffalo has multiple device which are using the trx format, but with different magic values. Signed-off-by:
Hauke Mehrtens <hauke@hauke-m.de> Acked-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-2-hauke@hauke-m.de
-
Tian Tao authored
The value of lastEUN is not used at line 622, and will rewrite a new value at line 541. so just remote the line at 622. Signed-off-by:
Tian Tao <tiantao6@hisilicon.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1618363874-25113-1-git-send-email-tiantao6@hisilicon.com
-
Tian Tao authored
Use sysfs_emit instead of snprintf to avoid buf overrun,because in sysfs_emit it strictly checks whether buf is null or buf whether pagesize aligned, otherwise it returns an error. Signed-off-by:
Tian Tao <tiantao6@hisilicon.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1618220144-33839-3-git-send-email-tiantao6@hisilicon.com
-
Tian Tao authored
Use sysfs_emit instead of snprintf to avoid buf overrun,because in sysfs_emit it strictly checks whether buf is null or buf whether pagesize aligned, otherwise it returns an error. Signed-off-by:
Tian Tao <tiantao6@hisilicon.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/1618220144-33839-2-git-send-email-tiantao6@hisilicon.com
-
Zhang Xiaoxu authored
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Reported-by:
Hulk Robot <hulkci@huawei.com> Signed-off-by:
Zhang Xiaoxu <zhangxiaoxu5@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210409010739.1021001-1-zhangxiaoxu5@huawei.com
-
Yu Kuai authored
Return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Reported-by:
Hulk Robot <hulkci@huawei.com> Signed-off-by:
Yu Kuai <yukuai3@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210408133812.1209798-1-yukuai3@huawei.com
-
Yu Kuai authored
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Reported-by:
Hulk Robot <hulkci@huawei.com> Signed-off-by:
Yu Kuai <yukuai3@huawei.com> Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210408111514.1011020-3-yukuai3@huawei.com
-
- 09 May, 2021 1 commit
-
-
Linus Torvalds authored
-