[QUERY]drivers: pnp: isapnp:proc.c: assignment inside if statement

anupamakpatil123 anupamakpatil123 at gmail.com
Tue Apr 20 14:05:25 EDT 2021

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

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.

Anupama K Patil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20210420/feddc543/attachment-0001.sig>

More information about the Kernelnewbies mailing list