From: Markus Elfring <Markus.Elfring@web.de>
To: James Bottomley <jejb@linux.ibm.com>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: scsi: ses: Move a label in ses_enclosure_data_process()
Date: Sat, 30 Dec 2023 14:36:37 +0100 [thread overview]
Message-ID: <a3825ab2-8987-4b85-9db0-642035789c49@web.de> (raw)
In-Reply-To: <a35c6128d4449fec00238c909e5f6f45ebf4bcba.camel@linux.ibm.com>
>> You probably know some advices from another information source.
>>
>> https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
>>
>
> Yes, but it's about using staged deallocation at the end of the
> function instead of in the if loops. That's to *simplify* the exit
> chain and make the error legs less error prone because the teardown
> isn't repeated in if bodies. It has no bearing on what you just tried
> to do.
I got the impression that there is a general conflict involved
according to different programming styles.
>>> If coccinelle
>>> suddenly thinks this is a problem, it's coccinelle that needs
>>> fixing.
>>
>> This software tool can help to point source code places out for
>> further considerations. The search patterns are evolving accordingly.
>
> The pattern is wrong because kfree(NULL) exists as a teardown simplification.
It might be convenient to view in this way.
If you would dare to follow advice from goto chains in a strict way,
I imagine that you can tend to stress the attention for more useful
data processing a bit more than such a redundant function call.
Regards,
Markus
next prev parent reply other threads:[~2023-12-30 13:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 14:48 [PATCH] " Markus Elfring
2023-12-29 17:21 ` James Bottomley
2023-12-29 17:29 ` Julia Lawall
2023-12-30 7:04 ` Markus Elfring
2023-12-30 12:41 ` James Bottomley
2023-12-30 13:36 ` Markus Elfring [this message]
2023-12-30 13:45 ` James Bottomley
2023-12-30 14:25 ` Markus Elfring
2023-12-31 14:07 ` James Bottomley
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=a3825ab2-8987-4b85-9db0-642035789c49@web.de \
--to=markus.elfring@web.de \
--cc=jejb@linux.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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
all inboxes | Powered by JetHome®