From: Shuah Khan <skhan@linuxfoundation.org>
To: anupamakpatil123 <anupamakpatil123@gmail.com>,
kernelnewbies@kernelnewbies.org
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
bkkarthik@pesu.pes.edu, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [QUERY]drivers: pnp: isapnp:proc.c: assignment inside if statement
Date: Tue, 20 Apr 2021 18:34:58 -0600 [thread overview]
Message-ID: <1aad00cf-fb4e-8d8d-775b-2d202133bdee@linuxfoundation.org> (raw)
In-Reply-To: <20210420180525.m2fckb2iowrzo2c4@ubuntu>
On 4/20/21 12:05 PM, anupamakpatil123 wrote:
> This is a code snippet from line 63 of drivers: pnp: isapnp: proc.c
> This is an error I came across while looking through some checkpatch
> errors.
>
> if (!(de = bus->procdir)) {
> sprintf(name, "%02x", bus->number);
> de = bus->procdir = proc_mkdir(name, isapnp_proc_bus_dir);
> if (!de)
> return -ENOMEM;
> }
>
> In the above code snippet is assignment inside the if statement
> necessary? Can the assignment be done outside the if statement as it is
> a good coding style practice?
> Is that change sufficient? I dont want to just shut checkpatch errors as I
> really want to improve the code.
>
> Thankyou for taking your time to go through this.
>
This looks correct to me. However, it could be changed to get rid
of the checkpatch error. It would be simple fix.
You could send patch in and get feedback from the driver maintainer.
thanks,
-- Shuah
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2021-04-26 3:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 18:05 [QUERY]drivers: pnp: isapnp:proc.c: assignment inside if statement anupamakpatil123
2021-04-21 0:34 ` Shuah Khan [this message]
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=1aad00cf-fb4e-8d8d-775b-2d202133bdee@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=anupamakpatil123@gmail.com \
--cc=bkkarthik@pesu.pes.edu \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.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 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).