Skip to contentSkip to conversation

soc: qcom: smem: better track SMEM uninitialized state

bug report Dan Carpenter 3 participants 4 messages Nov 21, 2025 Arm Qualcomm mailing list

lore
Share & tools
lore
#0 lore raw

Hello Christian Marangi,

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") from Oct 31, 2025 (linux-next), leads to the following Smatch static checker warning:

	drivers/soc/qcom/smem.c:519 qcom_smem_alloc()
	warn: '__smem' can also be NULL

drivers/soc/qcom/smem.c

    509 int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
    510 {
    511         struct smem_partition *part;
    512         unsigned long flags;
    513         int ret;
    514 
    515         if (IS_ERR(__smem))
    516                 return PTR_ERR(__smem);

We recently changed this from being NULL at the start to being -EPROBE_DEFER but the qcom_smem_remove() function still sets it to NULL and the qcom_smem_is_available() still expects it to be NULL at the start so it needs to be updated as well.

    517 
    518         if (item < SMEM_ITEM_LAST_FIXED) {
--> 519                 dev_err(__smem->dev,
    520                         "Rejecting allocation of static entry %d\n", item);
    521                 return -EINVAL;
    522         }

regards,
dan carpenter

#1 lore raw
Quoted 24 lines · Dan Carpenter

Hello Christian Marangi,

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") from Oct 31, 2025 (linux-next), leads to the following Smatch static checker warning:

	drivers/soc/qcom/smem.c:519 qcom_smem_alloc()
	warn: '__smem' can also be NULL

drivers/soc/qcom/smem.c

    509 int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
    510 {
    511         struct smem_partition *part;
    512         unsigned long flags;
    513         int ret;
    514 
    515         if (IS_ERR(__smem))
    516                 return PTR_ERR(__smem);

We recently changed this from being NULL at the start to being -EPROBE_DEFER but the qcom_smem_remove() function still sets it to NULL and the qcom_smem_is_available() still expects it to be NULL at the start so it needs to be updated as well.

Quoted 7 lines
    517 
    518         if (item < SMEM_ITEM_LAST_FIXED) {
--> 519                 dev_err(__smem->dev,
    520                         "Rejecting allocation of static entry %d\n", item);
    521                 return -EINVAL;
    522         }

Hi,

I remember editing qcom_smem_is_available but probably it got lost when amending the changes.

Creating a fix patch just now. Can you help me with what link I should put in the Closes tag?

Signature · 1 line
	Ansuel
#2 lore raw
Quoted 33 lines · Christian Marangi
Quoted 24 lines · Dan Carpenter

Hello Christian Marangi,

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") from Oct 31, 2025 (linux-next), leads to the following Smatch static checker warning:

	drivers/soc/qcom/smem.c:519 qcom_smem_alloc()
	warn: '__smem' can also be NULL

drivers/soc/qcom/smem.c

    509 int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
    510 {
    511         struct smem_partition *part;
    512         unsigned long flags;
    513         int ret;
    514 
    515         if (IS_ERR(__smem))
    516                 return PTR_ERR(__smem);

We recently changed this from being NULL at the start to being -EPROBE_DEFER but the qcom_smem_remove() function still sets it to NULL and the qcom_smem_is_available() still expects it to be NULL at the start so it needs to be updated as well.

Quoted 7 lines
    517 
    518         if (item < SMEM_ITEM_LAST_FIXED) {
--> 519                 dev_err(__smem->dev,
    520                         "Rejecting allocation of static entry %d\n", item);
    521                 return -EINVAL;
    522         }
Quoted 7 lines

Hi,

I remember editing qcom_smem_is_available but probably it got lost when amending the changes.

Creating a fix patch just now. Can you help me with what link I should put in the Closes tag?

All messages sent to any of the major lists are logged on lore.kernel.org

You can use the search box there (the main page will search *list names* by default although there's a "search all inboxes button" button too)

Alternatively you can do lore.kernel.org/listname/msgid

where the msgid you should be able to get from your email client (if you use Thunderbird there's an extension called 'Copy Message ID' that adds a button for this in the reading view)

so, this one becomes:
https://lore.kernel.org/linux-arm-msm/[email protected]/

Konrad

#3 lore raw
In reply to Christian Marangi
Quoted 33 lines · Christian Marangi
Quoted 24 lines · Dan Carpenter

Hello Christian Marangi,

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") from Oct 31, 2025 (linux-next), leads to the following Smatch static checker warning:

	drivers/soc/qcom/smem.c:519 qcom_smem_alloc()
	warn: '__smem' can also be NULL

drivers/soc/qcom/smem.c

    509 int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
    510 {
    511         struct smem_partition *part;
    512         unsigned long flags;
    513         int ret;
    514 
    515         if (IS_ERR(__smem))
    516                 return PTR_ERR(__smem);

We recently changed this from being NULL at the start to being -EPROBE_DEFER but the qcom_smem_remove() function still sets it to NULL and the qcom_smem_is_available() still expects it to be NULL at the start so it needs to be updated as well.

Quoted 7 lines
    517 
    518         if (item < SMEM_ITEM_LAST_FIXED) {
--> 519                 dev_err(__smem->dev,
    520                         "Rejecting allocation of static entry %d\n", item);
    521                 return -EINVAL;
    522         }
Quoted 7 lines

Hi,

I remember editing qcom_smem_is_available but probably it got lost when amending the changes.

Creating a fix patch just now. Can you help me with what link I should put in the Closes tag?

https://lore.kernel.org/all/[email protected]/

#!/usr/bin/perl

while (<>) {
    if ($_ =~ /Message-ID: \<(.*)\>/) {
        print "\n\n\n";
        print "https://lore.kernel.org/all/$1\n";
        print "\n\n\n";
    }
}

regards,
dan carpenter