* [PATCH 0/4] nvmem: fixes for 6.1
@ 2022-11-18 6:38 Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 1/4] nvmem: lan9662-otp: fix compatible name Srinivas Kandagatla
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-11-18 6:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla
Hi Greg,
Here is a few minor fixes in u-boot-env, rmem and lan9662-otp nvmem providers.
-two lan9662 fixes are to fix the compatible string and fix a smatch
warning.
- rmem fixes an error handling path.
- u-boot env has fix for data offset.
If its not too late, can you take them for 6.1.
Many thanks,
Srini
*** BLURB HERE ***
Christian Lamparter (1):
nvmem: u-boot-env: fix crc32_data_offset on redundant u-boot-env
Claudiu Beznea (1):
nvmem: lan9662-otp: fix compatible name
Horatiu Vultur (1):
nvmem: lan9662-otp: Change return type of
lan9662_otp_wait_flag_clear()
Wei Yongjun (1):
nvmem: rmem: Fix return value check in rmem_read()
drivers/nvmem/lan9662-otpc.c | 4 ++--
drivers/nvmem/rmem.c | 4 ++--
drivers/nvmem/u-boot-env.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] nvmem: lan9662-otp: fix compatible name
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
@ 2022-11-18 6:38 ` Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 2/4] nvmem: rmem: Fix return value check in rmem_read() Srinivas Kandagatla
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-11-18 6:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Claudiu Beznea, Fabrice Gasnier, Srinivas Kandagatla
From: Claudiu Beznea <claudiu.beznea@microchip.com>
Documentation of lan9662-otpc driver (namely Documentation/\
devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml) express that
compatible for this driver contains "otpc" string at the end but not "otp"
as currently present. Fix this typo.
Fixes: 9e8f208ad522 ("nvmem: lan9662-otp: add support")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/lan9662-otpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/lan9662-otpc.c b/drivers/nvmem/lan9662-otpc.c
index f6732fd216d8..377bf34c2946 100644
--- a/drivers/nvmem/lan9662-otpc.c
+++ b/drivers/nvmem/lan9662-otpc.c
@@ -203,7 +203,7 @@ static int lan9662_otp_probe(struct platform_device *pdev)
}
static const struct of_device_id lan9662_otp_match[] = {
- { .compatible = "microchip,lan9662-otp", },
+ { .compatible = "microchip,lan9662-otpc", },
{ },
};
MODULE_DEVICE_TABLE(of, lan9662_otp_match);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] nvmem: rmem: Fix return value check in rmem_read()
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 1/4] nvmem: lan9662-otp: fix compatible name Srinivas Kandagatla
@ 2022-11-18 6:38 ` Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 3/4] nvmem: u-boot-env: fix crc32_data_offset on redundant u-boot-env Srinivas Kandagatla
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-11-18 6:38 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Wei Yongjun, Srinivas Kandagatla,
Nicolas Saenz Julienne, Yang Yingliang
From: Wei Yongjun <weiyongjun1@huawei.com>
In case of error, the function memremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/rmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvmem/rmem.c b/drivers/nvmem/rmem.c
index b11c3c974b3d..80cb187f1481 100644
--- a/drivers/nvmem/rmem.c
+++ b/drivers/nvmem/rmem.c
@@ -37,9 +37,9 @@ static int rmem_read(void *context, unsigned int offset,
* but as of Dec 2020 this isn't possible on arm64.
*/
addr = memremap(priv->mem->base, available, MEMREMAP_WB);
- if (IS_ERR(addr)) {
+ if (!addr) {
dev_err(priv->dev, "Failed to remap memory region\n");
- return PTR_ERR(addr);
+ return -ENOMEM;
}
count = memory_read_from_buffer(val, bytes, &off, addr, available);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] nvmem: u-boot-env: fix crc32_data_offset on redundant u-boot-env
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 1/4] nvmem: lan9662-otp: fix compatible name Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 2/4] nvmem: rmem: Fix return value check in rmem_read() Srinivas Kandagatla
@ 2022-11-18 6:38 ` Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 4/4] nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear() Srinivas Kandagatla
2022-11-22 17:22 ` [PATCH 0/4] nvmem: fixes for 6.1 Greg KH
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-11-18 6:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Christian Lamparter
From: Christian Lamparter <chunkeey@gmail.com>
The Western Digital MyBook Live (PowerPC 464/APM82181)
has a set of redundant u-boot-env. Loading up the driver
the following error:
| u_boot_env: Invalid calculated CRC32: 0x4f8f2c86 (expected: 0x98b14514)
| u_boot_env: probe of partition@1e000 failed with error -22
Looking up the userspace libubootenv utilities source [0],
it looks like the "mark" or "flag" is not part of the
crc32 sum... which is unfortunate :(
|static int libuboot_load(struct uboot_ctx *ctx)
|{
|[...]
| if (ctx->redundant) {
| [...]
| offsetdata = offsetof(struct uboot_env_redund, data);
| [...] //-----^^
| }
| usable_envsize = ctx->size - offsetdata;
| buf[0] = malloc(bufsize);
|[...]
| for (i = 0; i < copies; i++) {
| data = (uint8_t *)(buf[i] + offsetdata);
| uint32_t crc;
|
| ret = devread(ctx, i, buf[i]);
| [...]
| crc = *(uint32_t *)(buf[i] + offsetcrc);
| dev->crc = crc32(0, (uint8_t *)data, usable_envsize);
|
[0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951
Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
drivers/nvmem/u-boot-env.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c
index 8e72d1bbd649..4fdbdccebda1 100644
--- a/drivers/nvmem/u-boot-env.c
+++ b/drivers/nvmem/u-boot-env.c
@@ -135,7 +135,7 @@ static int u_boot_env_parse(struct u_boot_env *priv)
break;
case U_BOOT_FORMAT_REDUNDANT:
crc32_offset = offsetof(struct u_boot_env_image_redundant, crc32);
- crc32_data_offset = offsetof(struct u_boot_env_image_redundant, mark);
+ crc32_data_offset = offsetof(struct u_boot_env_image_redundant, data);
data_offset = offsetof(struct u_boot_env_image_redundant, data);
break;
}
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear()
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
` (2 preceding siblings ...)
2022-11-18 6:38 ` [PATCH 3/4] nvmem: u-boot-env: fix crc32_data_offset on redundant u-boot-env Srinivas Kandagatla
@ 2022-11-18 6:38 ` Srinivas Kandagatla
2022-11-22 17:22 ` [PATCH 0/4] nvmem: fixes for 6.1 Greg KH
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-11-18 6:38 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Horatiu Vultur, kernel test robot, Dan Carpenter,
Srinivas Kandagatla
From: Horatiu Vultur <horatiu.vultur@microchip.com>
The blamed commit introduced the following smatch warning in the
function lan9662_otp_wait_flag_clear:
drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)'
Fix this by changing the return type of the function
lan9662_otp_wait_flag_clear() to be int instead of bool.
Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/lan9662-otpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/lan9662-otpc.c b/drivers/nvmem/lan9662-otpc.c
index 377bf34c2946..56fc19f092a7 100644
--- a/drivers/nvmem/lan9662-otpc.c
+++ b/drivers/nvmem/lan9662-otpc.c
@@ -36,7 +36,7 @@ struct lan9662_otp {
void __iomem *base;
};
-static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag)
+static int lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag)
{
u32 val;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] nvmem: fixes for 6.1
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
` (3 preceding siblings ...)
2022-11-18 6:38 ` [PATCH 4/4] nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear() Srinivas Kandagatla
@ 2022-11-22 17:22 ` Greg KH
4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2022-11-22 17:22 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-kernel
On Fri, Nov 18, 2022 at 06:38:36AM +0000, Srinivas Kandagatla wrote:
> Hi Greg,
>
> Here is a few minor fixes in u-boot-env, rmem and lan9662-otp nvmem providers.
> -two lan9662 fixes are to fix the compatible string and fix a smatch
> warning.
> - rmem fixes an error handling path.
> - u-boot env has fix for data offset.
>
> If its not too late, can you take them for 6.1.
>
2 of these were already in 6.1-rc6, but I took the others now as well.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-22 17:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 6:38 [PATCH 0/4] nvmem: fixes for 6.1 Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 1/4] nvmem: lan9662-otp: fix compatible name Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 2/4] nvmem: rmem: Fix return value check in rmem_read() Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 3/4] nvmem: u-boot-env: fix crc32_data_offset on redundant u-boot-env Srinivas Kandagatla
2022-11-18 6:38 ` [PATCH 4/4] nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear() Srinivas Kandagatla
2022-11-22 17:22 ` [PATCH 0/4] nvmem: fixes for 6.1 Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®