From: Jan Kasprzak <kas@fi.muni.cz>
To: cgel.zte@gmail.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Lv Ruyi <lv.ruyi@zte.com.cn>, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] net: cosa: fix error check return value of register_chrdev()
Date: Tue, 19 Apr 2022 10:32:28 +0200 [thread overview]
Message-ID: <20220419083228.GA25641@fi.muni.cz> (raw)
In-Reply-To: <20220418105834.2558892-1-lv.ruyi@zte.com.cn>
Acked-By: Jan "Yenya" Kasprzak <kas@fi.muni.cz>
Thanks!
-Yenya
cgel.zte@gmail.com wrote:
: From: Lv Ruyi <lv.ruyi@zte.com.cn>
:
: If major equal 0, register_chrdev() returns error code when it fails.
: This function dynamically allocate a major and return its number on
: success, so we should use "< 0" to check it instead of "!".
:
: Reported-by: Zeal Robot <zealci@zte.com.cn>
: Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
: ---
: drivers/net/wan/cosa.c | 2 +-
: 1 file changed, 1 insertion(+), 1 deletion(-)
:
: diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
: index 23d2954d9747..1e5672019922 100644
: --- a/drivers/net/wan/cosa.c
: +++ b/drivers/net/wan/cosa.c
: @@ -349,7 +349,7 @@ static int __init cosa_init(void)
: }
: } else {
: cosa_major = register_chrdev(0, "cosa", &cosa_fops);
: - if (!cosa_major) {
: + if (cosa_major < 0) {
: pr_warn("unable to register chardev\n");
: err = -EIO;
: goto out;
: --
: 2.25.1
:
--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| http://www.fi.muni.cz/~kas/ GPG: 4096R/A45477D5 |
We all agree on the necessity of compromise. We just can't agree on
when it's necessary to compromise. --Larry Wall
next prev parent reply other threads:[~2022-04-19 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 10:58 [PATCH] net: cosa: fix error check return value of register_chrdev() cgel.zte
2022-04-19 8:32 ` Jan Kasprzak [this message]
2022-04-22 9:30 ` patchwork-bot+netdevbpf
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=20220419083228.GA25641@fi.muni.cz \
--to=kas@fi.muni.cz \
--cc=cgel.zte@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.ruyi@zte.com.cn \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zealci@zte.com.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).