From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org,
Govind Singh <govinds@codeaurora.org>,
linux-wireless@vger.kernel.org, ath10k@lists.infradead.org
Subject: Re: [PATCH] ath10k: fix a NULL vs IS_ERR() check
Date: Mon, 26 Nov 2018 15:06:33 +0200 [thread overview]
Message-ID: <87va4k9eee.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20181126083021.GC3088@unbuntlaptop> (Dan Carpenter's message of "Mon, 26 Nov 2018 11:30:22 +0300")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> On Mon, Nov 26, 2018 at 10:24:38AM +0200, Kalle Valo wrote:
>> Dan Carpenter <dan.carpenter@oracle.com> writes:
>>
>> > The devm_memremap() function doesn't return NULLs, it returns error
>> > pointers.
>> >
>> > Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
>> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> > ---
>> > drivers/net/wireless/ath/ath10k/qmi.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c
>> > index f0429bee35c2..37b3bd629f48 100644
>> > --- a/drivers/net/wireless/ath/ath10k/qmi.c
>> > +++ b/drivers/net/wireless/ath/ath10k/qmi.c
>> > @@ -931,9 +931,9 @@ static int ath10k_qmi_setup_msa_resources(struct ath10k_qmi *qmi, u32 msa_size)
>> > qmi->msa_mem_size = resource_size(&r);
>> > qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size,
>> > MEMREMAP_WT);
>> > - if (!qmi->msa_va) {
>> > + if (IS_ERR(qmi->msa_va)) {
>> > dev_err(dev, "failed to map memory region: %pa\n", &r.start);
>> > - return -EBUSY;
>> > + return PTR_ERR(qmi->msa_va);
>>
>> That's a very good find!
>>
>> But how has this even worked before?
>
> This only changes the error path. Presumably it always succeeds in real
> life.
Ah, I missed the "!" operator. Yeah, I think you are correct. I'll queue
this for -next then.
--
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org,
Govind Singh <govinds@codeaurora.org>,
linux-wireless@vger.kernel.org, ath10k@lists.infradead.org
Subject: Re: [PATCH] ath10k: fix a NULL vs IS_ERR() check
Date: Mon, 26 Nov 2018 13:06:33 +0000 [thread overview]
Message-ID: <87va4k9eee.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20181126083021.GC3088@unbuntlaptop> (Dan Carpenter's message of "Mon, 26 Nov 2018 11:30:22 +0300")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> On Mon, Nov 26, 2018 at 10:24:38AM +0200, Kalle Valo wrote:
>> Dan Carpenter <dan.carpenter@oracle.com> writes:
>>
>> > The devm_memremap() function doesn't return NULLs, it returns error
>> > pointers.
>> >
>> > Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
>> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> > ---
>> > drivers/net/wireless/ath/ath10k/qmi.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c
>> > index f0429bee35c2..37b3bd629f48 100644
>> > --- a/drivers/net/wireless/ath/ath10k/qmi.c
>> > +++ b/drivers/net/wireless/ath/ath10k/qmi.c
>> > @@ -931,9 +931,9 @@ static int ath10k_qmi_setup_msa_resources(struct ath10k_qmi *qmi, u32 msa_size)
>> > qmi->msa_mem_size = resource_size(&r);
>> > qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size,
>> > MEMREMAP_WT);
>> > - if (!qmi->msa_va) {
>> > + if (IS_ERR(qmi->msa_va)) {
>> > dev_err(dev, "failed to map memory region: %pa\n", &r.start);
>> > - return -EBUSY;
>> > + return PTR_ERR(qmi->msa_va);
>>
>> That's a very good find!
>>
>> But how has this even worked before?
>
> This only changes the error path. Presumably it always succeeds in real
> life.
Ah, I missed the "!" operator. Yeah, I think you are correct. I'll queue
this for -next then.
--
Kalle Valo
WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Govind Singh <govinds@codeaurora.org>,
ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ath10k: fix a NULL vs IS_ERR() check
Date: Mon, 26 Nov 2018 15:06:33 +0200 [thread overview]
Message-ID: <87va4k9eee.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20181126083021.GC3088@unbuntlaptop> (Dan Carpenter's message of "Mon, 26 Nov 2018 11:30:22 +0300")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> On Mon, Nov 26, 2018 at 10:24:38AM +0200, Kalle Valo wrote:
>> Dan Carpenter <dan.carpenter@oracle.com> writes:
>>
>> > The devm_memremap() function doesn't return NULLs, it returns error
>> > pointers.
>> >
>> > Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
>> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> > ---
>> > drivers/net/wireless/ath/ath10k/qmi.c | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c
>> > index f0429bee35c2..37b3bd629f48 100644
>> > --- a/drivers/net/wireless/ath/ath10k/qmi.c
>> > +++ b/drivers/net/wireless/ath/ath10k/qmi.c
>> > @@ -931,9 +931,9 @@ static int ath10k_qmi_setup_msa_resources(struct ath10k_qmi *qmi, u32 msa_size)
>> > qmi->msa_mem_size = resource_size(&r);
>> > qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size,
>> > MEMREMAP_WT);
>> > - if (!qmi->msa_va) {
>> > + if (IS_ERR(qmi->msa_va)) {
>> > dev_err(dev, "failed to map memory region: %pa\n", &r.start);
>> > - return -EBUSY;
>> > + return PTR_ERR(qmi->msa_va);
>>
>> That's a very good find!
>>
>> But how has this even worked before?
>
> This only changes the error path. Presumably it always succeeds in real
> life.
Ah, I missed the "!" operator. Yeah, I think you are correct. I'll queue
this for -next then.
--
Kalle Valo
next prev parent reply other threads:[~2018-11-26 13:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 8:11 [PATCH] ath10k: fix a NULL vs IS_ERR() check Dan Carpenter
2018-11-26 8:11 ` Dan Carpenter
2018-11-26 8:11 ` Dan Carpenter
2018-11-26 8:24 ` Kalle Valo
2018-11-26 8:24 ` Kalle Valo
2018-11-26 8:24 ` Kalle Valo
2018-11-26 8:30 ` Dan Carpenter
2018-11-26 8:30 ` Dan Carpenter
2018-11-26 8:30 ` Dan Carpenter
2018-11-26 13:06 ` Kalle Valo [this message]
2018-11-26 13:06 ` Kalle Valo
2018-11-26 13:06 ` Kalle Valo
2018-12-20 17:05 ` Kalle Valo
2018-12-20 17:05 ` Kalle Valo
2018-12-20 17:05 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87va4k9eee.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=ath10k@lists.infradead.org \
--cc=dan.carpenter@oracle.com \
--cc=govinds@codeaurora.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.