<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/mtd/lpddr, branch v6.12.91</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.91</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.91'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-18T12:55:13+00:00</updated>
<entry>
<title>mtd: lpddr_cmds: fix signed shifts in lpddr_cmds</title>
<updated>2025-12-18T12:55:13+00:00</updated>
<author>
<name>Ivan Stepchenko</name>
<email>sid@itb.spb.ru</email>
</author>
<published>2025-11-21T11:54:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6e1acbe563ddd0e477a1b5bcc548952f9f37bbdc'/>
<id>urn:sha1:6e1acbe563ddd0e477a1b5bcc548952f9f37bbdc</id>
<content type='text'>
[ Upstream commit c909fec69f84b39e63876c69b9df2c178c6b76ba ]

There are several places where a value of type 'int' is shifted by
lpddr-&gt;chipshift. lpddr-&gt;chipshift is derived from QINFO geometry and
might reach 31 when QINFO reports a 2 GiB size - the maximum supported by
LPDDR(1) compliant chips. This may cause unexpected sign-extensions when
casting the integer value to the type of 'unsigned long'.

Use '1UL &lt;&lt; lpddr-&gt;chipshift' and cast 'j' to unsigned long before
shifting so the computation is performed at the destination width.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c68264711ca6 ("[MTD] LPDDR Command set driver")
Signed-off-by: Ivan Stepchenko &lt;sid@itb.spb.ru&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>mtd: lpddr2_nvm: Convert to platform remove callback returning void</title>
<updated>2023-10-16T08:56:48+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2023-10-08T20:01:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54600e40241395bd470fc02063f8f4d11155c12b'/>
<id>urn:sha1:54600e40241395bd470fc02063f8f4d11155c12b</id>
<content type='text'>
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Acked-by: Tudor Ambarus &lt;tudor.ambarus@linaro.org&gt;
Link: https://lore.kernel.org/linux-mtd/20231008200143.196369-12-u.kleine-koenig@pengutronix.de
</content>
</entry>
<entry>
<title>mtd: lpddr_cmds: Add literal suffix</title>
<updated>2023-09-11T15:50:42+00:00</updated>
<author>
<name>Denis Arefev</name>
<email>arefev@swemel.ru</email>
</author>
<published>2023-08-24T13:02:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8ffd18a6744b18ff9b58abf7261aaccd78be98cf'/>
<id>urn:sha1:8ffd18a6744b18ff9b58abf7261aaccd78be98cf</id>
<content type='text'>
The value of an arithmetic expression
1 &lt;&lt; lpddr-&gt;qinfo-&gt;DevSizeShift is subject to overflow
due to a failure to cast operands to a larger data
type before performing arithmetic

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev &lt;arefev@swemel.ru&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20230824130215.10396-1-arefev@swemel.ru
</content>
</entry>
<entry>
<title>mtd: lpddr2_nvm: Convert to devm_platform_ioremap_resource()</title>
<updated>2023-07-12T12:08:26+00:00</updated>
<author>
<name>Yangtao Li</name>
<email>frank.li@vivo.com</email>
</author>
<published>2023-07-07T04:06:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a29f696aa96f94ced1655b183c9694920d8bbfe2'/>
<id>urn:sha1:a29f696aa96f94ced1655b183c9694920d8bbfe2</id>
<content type='text'>
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li &lt;frank.li@vivo.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20230707040622.78174-15-frank.li@vivo.com
</content>
</entry>
<entry>
<title>mtd: lpddr_cmds: remove unused words variable</title>
<updated>2023-03-28T12:59:21+00:00</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2023-03-28T00:06:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e6026eb080fa1c1ef6eec24567b733809a5e3018'/>
<id>urn:sha1:e6026eb080fa1c1ef6eec24567b733809a5e3018</id>
<content type='text'>
clang with W=1 reports
drivers/mtd/lpddr/lpddr_cmds.c:409:31: error: variable
  'words' set but not used [-Werror,-Wunused-but-set-variable]
        int ret, wbufsize, word_gap, words;
                                     ^
This variable is not used so remove it.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20230328000620.1778033-1-trix@redhat.com
</content>
</entry>
<entry>
<title>mtd: lpddr2_nvm: Fix possible null-ptr-deref</title>
<updated>2022-11-17T20:59:03+00:00</updated>
<author>
<name>Hui Tang</name>
<email>tanghui20@huawei.com</email>
</author>
<published>2022-11-14T09:02:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6bdd45d795adf9e73b38ced5e7f750cd199499ff'/>
<id>urn:sha1:6bdd45d795adf9e73b38ced5e7f750cd199499ff</id>
<content type='text'>
It will cause null-ptr-deref when resource_size(add_range) invoked,
if platform_get_resource() returns NULL.

Fixes: 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
Signed-off-by: Hui Tang &lt;tanghui20@huawei.com&gt;
Acked-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20221114090240.244172-1-tanghui20@huawei.com
</content>
</entry>
<entry>
<title>mtd: lpddr2_nvm: Warn about failure to unregister mtd device</title>
<updated>2022-06-09T13:06:16+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2022-06-03T21:07:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0aaa0b5f84a0908fb2de30e8fea10811b154bf56'/>
<id>urn:sha1:0aaa0b5f84a0908fb2de30e8fea10811b154bf56</id>
<content type='text'>
mtd_device_unregister() shouldn't fail. Wail loudly if it does anyhow.

This matches how other drivers (e.g. nand/raw/nandsim.c) use
mtd_device_unregister().

By returning 0 in the platform remove callback a generic error message
by the device core is suppressed, nothing else changes.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20220603210758.148493-6-u.kleine-koenig@pengutronix.de
</content>
</entry>
<entry>
<title>mtd: lpddr: fix excessive stack usage with clang</title>
<updated>2020-08-27T12:36:07+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2020-05-05T14:01:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3e1b6469f8324bee5927b063e2aca30d3e56b907'/>
<id>urn:sha1:3e1b6469f8324bee5927b063e2aca30d3e56b907</id>
<content type='text'>
Building lpddr2_nvm with clang can result in a giant stack usage
in one function:

drivers/mtd/lpddr/lpddr2_nvm.c:399:12: error: stack frame size of 1144 bytes in function 'lpddr2_nvm_probe' [-Werror,-Wframe-larger-than=]

The problem is that clang decides to build a copy of the mtd_info
structure on the stack and then do a memcpy() into the actual version. It
shouldn't really do it that way, but it's not strictly a bug either.

As a workaround, use a static const version of the structure to assign
most of the members upfront and then only set the few members that
require runtime knowledge at probe time.

Fixes: 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Acked-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20200505140136.263461-1-arnd@arndb.de
</content>
</entry>
<entry>
<title>mtd: lpddr: Move function print_drs_error to lpddr_cmds.c</title>
<updated>2020-08-27T12:14:46+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavo@embeddedor.com</email>
</author>
<published>2020-04-27T19:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1a64026eda1642c81425e48550fd4bd3f73d0ab5'/>
<id>urn:sha1:1a64026eda1642c81425e48550fd4bd3f73d0ab5</id>
<content type='text'>
Function print_drs_error is only used in drivers/mtd/lpddr/lpddr_cmds.c
so, better to move it there.

Also, notice that there's no need for inline as the function is used
once.  Lastly, fix the following checkpatch warning:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
+static void print_drs_error(unsigned dsr)

Suggested-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Reviewed-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/e0063cbd65f3b47be1db34efc494ea3047634d88.1588016644.git.gustavo@embeddedor.com
</content>
</entry>
<entry>
<title>mtd: Convert fallthrough comments into statements</title>
<updated>2020-03-30T08:14:54+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2020-03-25T21:21:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=025a06c1104cd8995646b761d117816b5f28c873'/>
<id>urn:sha1:025a06c1104cd8995646b761d117816b5f28c873</id>
<content type='text'>
Use Joe Perches cvt_fallthrough.pl script to convert

	/* fallthrough */

comments (and its derivatives) into a

	fallthrough;

statement. This automatically drops useless ones.

Do it MTD-wide.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Acked-by: Vignesh Raghavendra &lt;vigneshr@ti.com&gt;
Acked-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Acked-by: Richard Weinberger &lt;richard@nod.at&gt;
Link: https://lore.kernel.org/linux-mtd/20200325212115.14170-1-miquel.raynal@bootlin.com
</content>
</entry>
</feed>
