summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2021-08-17Merge tag 'samsung-pinctrl-5.15' of ↵Linus Walleij
https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung into devel Samsung pinctrl drivers changes for v5.15 1. Fix number of pins in one GPIO pin bank. 2. Add support for Exynos850 SoC (Exynos3830).
2021-08-17i2c: synquacer: fix deferred probingSergey Shtylyov
The driver overrides the error codes returned by platform_get_irq() to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe permanently instead of the deferred probing. Switch to propagating the error codes upstream. Fixes: 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C controller") Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-08-17i2c: sun6i-pw2i: Prefer strscpy over strlcpyLen Baker
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated. The safe replacement is strscpy(). This is a previous step in the path to remove the strlcpy() function entirely from the kernel [1]. [1] https://github.com/KSPP/linux/issues/89 Signed-off-by: Len Baker <len.baker@gmx.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-08-17i2c: remove dead PMC MSP TWI/SMBus/I2C driverLukas Bulwahn
Commit 1b00767fd8e1 ("MIPS: Remove PMC MSP71xx platform") removes the config PMC_MSP in ./arch/mips/Kconfig. Hence, since then, the corresponding PMC MSP TWI/SMBus/I2C driver is dead code. Remove this dead driver. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2021-08-17platform/x86: intel_pmc_core: Prevent possibile overflowDavid E. Box
Substate priority levels are encoded in 4 bits in the LPM_PRI register. This value was used as an index to an array whose element size was less than 16, leading to the possibility of overflow should we read a larger than expected priority. In addition to the overflow, bad values could lead to incorrect state reporting. So rework the priority code to prevent the overflow and perform some validation of the register. Use the priority register values if they give an ordering of unique numbers between 0 and the maximum number of states. Otherwise, use a default ordering instead. Reported-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210814014728.520856-1-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-08-17Merge branch 'cpufreq/arm/fixes' of ↵Rafael J. Wysocki
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm Pull ARM cpufreq fixes for v5.14 from Viresh Kumar: "This contains: - Addition of SoCs to blocklist for cpufreq-dt driver (Bjorn Andersson and Thara Gopinath). - Fix error path for scmi driver (Lukasz Luba). - Temporarily disable highest frequency for armada, its unsafe and breaks stuff." * 'cpufreq/arm/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev cpufreq: arm_scmi: Fix error path when allocation failed cpufreq: blacklist Qualcomm sc8180x in cpufreq-dt-platdev
2021-08-17clk: staging: correct reference to config IOMEM to config HAS_IOMEMLukas Bulwahn
Commit 0a0a66c984b3 ("clk: staging: Specify IOMEM dependency for Xilinx Clocking Wizard driver") introduces a dependency on the non-existing config IOMEM, which basically makes it impossible to include this driver into any build. Fortunately, ./scripts/checkkconfigsymbols.py warns: IOMEM Referencing files: drivers/staging/clocking-wizard/Kconfig The config for IOMEM support is called HAS_IOMEM. Correct this reference to the intended config. Fixes: 0a0a66c984b3 ("clk: staging: Specify IOMEM dependency for Xilinx Clocking Wizard driver") Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Link: https://lore.kernel.org/r/20210817105404.13146-1-lukas.bulwahn@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: remove unneeded DBG_88E call from rtl8188e_Add_RateATidPhillip Potter
Remove unneeded DBG_88E macro call from the rtl8188e_Add_RateATid function in hal/rtl8188e_cmd.c, as it is not particularly clear in my opinion, and we should strive towards use of existing kernel machinery for debugging purposes. Acked-by: Michael Straube <straube.linux@gmail.com> Signed-off-by: Phillip Potter <phil@philpotter.co.uk> Link: https://lore.kernel.org/r/20210816234459.132239-3-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: remove set but unused variable from rtl8188e_Add_RateATidPhillip Potter
Remove set but unused variable init_rate from the rtl8188e_Add_RateATid function in hal/rtl8188eu_cmd.c, as this fixes a kernel test robot warning. Removing the call to get_highest_rate_idx has no side effects here so is safe. Reported-by: kernel test robot <lkp@intel.com> Acked-by: Michael Straube <straube.linux@gmail.com> Signed-off-by: Phillip Potter <phil@philpotter.co.uk> Link: https://lore.kernel.org/r/20210816234459.132239-2-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in os_dep dirMichael Straube
Clean up spacing style issues reported by checkpatch in the os_dep directory. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited before semicolon WARNING: space prohibited between function name and open parenthesis '(' ERROR: spaces required around that '=' (ctx:VxV) Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816211053.31728-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in hal dir, part 3Michael Straube
Clean up spacing style issues reported by checkpatch in the remaining files in the hal directory. CHECK: spaces preferred around that ... Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816205511.20068-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in hal dir, part 2Michael Straube
Clean up spacing style issues reported by checkpatch in the next 10 files in the hal directory. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited before semicolon WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816205511.20068-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in hal dir, part 1Michael Straube
Clean up spacing style issues reported by checkpatch in the first 10 files in the hal directory. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816205511.20068-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_sta_mgt.cMichael Straube
Clean up spacing style issues in core/rtw_sta_mgt.c reported by checkpatch. WARNING: space prohibited between function name and open parenthesis '(' CHECK: spaces preferred around that '/' (ctx:VxV) WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-23-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: add space around operator in core/rtw_sreset.cMichael Straube
Add missing space around operator in core/rtw_sreset.c reported by checkpatch. CHECK: spaces preferred around that '|' (ctx:VxV) Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-22-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_debug.cMichael Straube
Clean up spacing style issues in core/rtw_debug.c reported by checkpatch. CHECK: spaces preferred around that '%' (ctx:VxV) WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-21-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_xmit.cMichael Straube
Clean up spacing style issues in core/rtw_xmit.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-20-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: add spaces around operators in core/rtw_wlan_util.cMichael Straube
Add missung spaces around operators in core/rtw_wlan_util.c reported by checkpatch. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-19-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_security.cMichael Straube
Clean up spacing style issues in core/rtw_security.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-18-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_recv.cMichael Straube
Clean up spacing style issues in core/rtw_recv.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-17-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_pwrctrl.cMichael Straube
Clean up spacing style issues in core/rtw_pwrctrl.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-16-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_p2p.cMichael Straube
Clean up spacing style issues in core/rtw_p2p.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited before semicolon WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-15-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_mp_ioctl.cMichael Straube
Clean up spacing style issues in core/rtw_mp_ioctl.c reported by checkpatch. CHECK: spaces preferred around that '|' (ctx:VxV) WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-14-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_mp.cMichael Straube
Clean up spacing style issues in core/rtw_mp.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-13-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_mlme_ext.cMichael Straube
Clean up spacing style issues in core/rtw_mlme_ext.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-12-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_mlme.cMichael Straube
Clean up spacing style issues in core/rtw_mlme.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-11-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: add spaces around operators in core/rtw_iol.cMichael Straube
Add missing spaces around operators in core/rtw_iol.c reported by checkpatch. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-10-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_ioctl_set.cMichael Straube
Clean up spacing style issues in core/rtw_ioctl_set.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-9-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: simplify multiplication in core/rtw_ioctl_set.cMichael Straube
Simplify multiplication in core/rtw_ioctl_set.c. to improve readability and clear a checkpatch issue. CHECK: spaces preferred around that '/' (ctx:VxV) Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-8-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_ieee80211.cMichael Straube
Clean up spacing style issues in core/rtw_ieee80211.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_efuse.cMichael Straube
Clean up spacing style issues in core/rtw_efuse.c reported by checkpatch. CHECK: spaces preferred around that ... WARNING: space prohibited before semicolon Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: clean up spacing style issues in core/rtw_cmd.cMichael Straube
Clean up spacing style issues in core/rtw_cmd.c reported by checkpatch. CHECK: spaces preferred around that ... CHECK: No space is necessary after a cast WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: remove unnecessary parentheses in core/rtw_cmd.cMichael Straube
Remove unnecessary parentheses in core/rtw_cmd.c. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: rewrite subtraction in core/rtw_cmd.cMichael Straube
Rewrite subtraction in core/rtw_cmd.c to clear missing spaces around operator reported by checkpatch. 256-1 -> 255 Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17staging: r8188eu: add spaces around operators in core/rtw_ap.cMichael Straube
Add missing spaces around operators in core/rtw_ap.c reported by checkpatch. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210816155818.24005-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-17drm: Copy drm_wait_vblank to user before returningMark Yacoub
[Why] Userspace should get back a copy of drm_wait_vblank that's been modified even when drm_wait_vblank_ioctl returns a failure. Rationale: drm_wait_vblank_ioctl modifies the request and expects the user to read it back. When the type is RELATIVE, it modifies it to ABSOLUTE and updates the sequence to become current_vblank_count + sequence (which was RELATIVE), but now it became ABSOLUTE. drmWaitVBlank (in libdrm) expects this to be the case as it modifies the request to be Absolute so it expects the sequence to would have been updated. The change is in compat_drm_wait_vblank, which is called by drm_compat_ioctl. This change of copying the data back regardless of the return number makes it en par with drm_ioctl, which always copies the data before returning. [How] Return from the function after everything has been copied to user. Fixes IGT:kms_flip::modeset-vs-vblank-race-interruptible Tested on ChromeOS Trogdor(msm) Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Signed-off-by: Mark Yacoub <markyacoub@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210812194917.1703356-1-markyacoub@chromium.org
2021-08-17Merge tag 'iio-for-5.15b' of ↵Greg Kroah-Hartman
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 2nd set of new IIO device support and cleanups for the 5.15 cycle. A small pull request to pick up a few new drivers and some cleanup and fix patches. New device support * ad5110 non-volatile digital potentiometer - New driver * renesas rzl/gl2 12-bit / 8 channel ADC block - New driver and bindings Minor or late breaking fixes and cleanups * ltc2983 - Fix a false assumption of initial interrupt during probe(). * hp03 - Use devm_* to simplify probe and allow the remove function to be dropped. * rockchip_saradc - Use a regulator notifier to reduce overheads of querying the scale. * tag 'iio-for-5.15b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: adc: Add driver for Renesas RZ/G2L A/D converter dt-bindings: iio: adc: Add binding documentation for Renesas RZ/G2L A/D converter iio: pressure: hp03: update device probe to register with devm functions iio: adc: rockchip_saradc: add voltage notifier so get referenced voltage once at probe iio: ltc2983: fix device probe iio: potentiometer: Add driver support for AD5110 dt-bindings: iio: potentiometer: Add AD5110 in trivial-devices
2021-08-17i40e: Fix spelling mistake "dissable" -> "disable"Colin Ian King
There is a spelling mistake in a dev_info message. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-08-17iavf: use mutexes for locking of critical sectionsStefan Assmann
As follow-up to the discussion with Jakub Kicinski about iavf locking being insufficient [1] convert iavf to use mutexes instead of bitops. The locking logic is kept as is, just a drop-in replacement of enum iavf_critical_section_t with separate mutexes. The only difference is that the mutexes will be destroyed before the module is unloaded. [1] https://lwn.net/ml/netdev/20210316150210.00007249%40intel.com/ Signed-off-by: Stefan Assmann <sassmann@kpanic.de> Tested-by: Marek Szlosek <marek.szlosek@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-08-17mtd: rawnand: intel: Fix error handling in probeEvgeny Novikov
ebu_nand_probe() did not invoke ebu_dma_cleanup() and clk_disable_unprepare() on some error handling paths. The patch fixes that. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 0b1039f016e8 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com> Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com> Co-developed-by: Anton Vasilyev <vasilyev@ispras.ru> Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210817092930.23040-1-novikov@ispras.ru
2021-08-17mtd: mtdconcat: Check _read, _write callbacks existence before assignmentZhihao Cheng
Since 2431c4f5b46c3 ("mtd: Implement mtd_{read,write}() as wrappers around mtd_{read,write}_oob()") don't allow _write|_read and _write_oob|_read_oob existing at the same time, we should check the existence of callbacks "_read and _write" from subdev's master device (We can trust master device since it has been registered) before assigning, otherwise following warning occurs while making concatenated device: WARNING: CPU: 2 PID: 6728 at drivers/mtd/mtdcore.c:595 add_mtd_device+0x7f/0x7b0 Fixes: 2431c4f5b46c3 ("mtd: Implement mtd_{read,write}() around ...") Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210817114857.2784825-3-chengzhihao1@huawei.com
2021-08-17mtd: mtdconcat: Judge callback existence based on the masterZhihao Cheng
Since commit 46b5889cc2c5("mtd: implement proper partition handling") applied, mtd partition device won't hold some callback functions, such as _block_isbad, _block_markbad, etc. Besides, function mtd_block_isbad() will get mtd device's master mtd device, then invokes master mtd device's callback function. So, following process may result mtd_block_isbad() always return 0, even though mtd device has bad blocks: 1. Split a mtd device into 3 partitions: PA, PB, PC [ Each mtd partition device won't has callback function _block_isbad(). ] 2. Concatenate PA and PB as a new mtd device PN [ mtd_concat_create() finds out each subdev has no callback function _block_isbad(), so PN won't be assigned callback function concat_block_isbad(). ] Then, mtd_block_isbad() checks "!master->_block_isbad" is true, will always return 0. Reproducer: // reproduce.c static int __init init_diy_module(void) { struct mtd_info *mtd[2]; struct mtd_info *mtd_combine = NULL; mtd[0] = get_mtd_device_nm("NAND simulator partition 0"); if (!mtd[0]) { pr_err("cannot find mtd1\n"); return -EINVAL; } mtd[1] = get_mtd_device_nm("NAND simulator partition 1"); if (!mtd[1]) { pr_err("cannot find mtd2\n"); return -EINVAL; } put_mtd_device(mtd[0]); put_mtd_device(mtd[1]); mtd_combine = mtd_concat_create(mtd, 2, "Combine mtd"); if (mtd_combine == NULL) { pr_err("combine failed\n"); return -EINVAL; } mtd_device_register(mtd_combine, NULL, 0); pr_info("Combine success\n"); return 0; } 1. ID="0x20,0xac,0x00,0x15" 2. modprobe nandsim id_bytes=$ID parts=50,100 badblocks=100 3. insmod reproduce.ko 4. flash_erase /dev/mtd3 0 0 libmtd: error!: MEMERASE64 ioctl failed for eraseblock 100 (mtd3) error 5 (Input/output error) // Should be "flash_erase: Skipping bad block at 00c80000" Fixes: 46b5889cc2c54bac ("mtd: implement proper partition handling") Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210817114857.2784825-2-chengzhihao1@huawei.com
2021-08-17mtd: maps: remove dead MTD map driver for PMC-Sierra MSP boardsLukas Bulwahn
Commit 1b00767fd8e1 ("MIPS: Remove PMC MSP71xx platform") removes the config PMC_MSP in ./arch/mips/Kconfig. Hence, since then, the corresponding MTD map driver for PMC-Sierra MSP boards is dead code. Remove this dead driver. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210817104531.12675-1-lukas.bulwahn@gmail.com
2021-08-17mtd: rfd_ftl: use container_of() rather than castSean Young
The container_of() is much more readable and also safer. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210807214538.14484-6-sean@mess.org
2021-08-17mtd: rfd_ftl: fix use-after-freeSean Young
del_mtd_blktrans_dev() will kfree part, so after this call both part and dev point to freed memory. Move the call to avoid use-after-free. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210807214538.14484-5-sean@mess.org
2021-08-17mtd: rfd_ftl: add discard supportSean Young
I proposed this change 16 years ago before discard was a feature in the block layer: https://lwn.net/Articles/162776/ Now that the block layer has discard, we can finally merge this change. Discard is also known as trim. By implementing discard, both fstrim and the discard filesystem option can be used. Implementing discard in the ftl means that when files are removed, there is less data in the ftl mapping. This means less stuff to move around for erasing and also less erasing to do; this means improved wear levelling and improved performance. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210807214538.14484-3-sean@mess.org
2021-08-17mtd: rfd_ftl: allow use of MTD_RAM for testing purposesSean Young
This allows the rfd_ftl to be used with the mtdram module, so we can test different mtd sizes and test the rfd_ftl on machines without a physical nor flash device. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210807214538.14484-2-sean@mess.org
2021-08-17mtdblock: Warn if added for a NAND deviceEzequiel Garcia
There is a surprisingly large number of tutorials that suggest using mtdblock to mount SquashFS filesystems on flash devices, including NAND devices. This approach is suboptimal than using UBI. If the flash device is NAND, this is specially true, due to wear leveling, bit-flips and badblocks. In this case UBI is strongly preferred, so be nice to users and print a warning suggesting to consider UBI block, if mtdblock is added for a NAND device. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210801234509.18774-8-ezequiel@collabora.com
2021-08-17net: qlcnic: add missed unlock in qlcnic_83xx_flash_read32Dinghao Liu
qlcnic_83xx_unlock_flash() is called on all paths after we call qlcnic_83xx_lock_flash(), except for one error path on failure of QLCRD32(), which may cause a deadlock. This bug is suggested by a static analysis tool, please advise. Fixes: 81d0aeb0a4fff ("qlcnic: flash template based firmware reset recovery") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Link: https://lore.kernel.org/r/20210816131405.24024-1-dinghao.liu@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-17media/atomisp: Use lockdep instead of *mutex_is_locked()Peter Zijlstra
The only user of rt_mutex_is_locked() is an anti-pattern, remove it. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211302.491442626@linutronix.de