mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.ibm.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
	kashyap.desai@broadcom.com
Cc: sumit.saxena@broadcom.com,
	shivasharan.srikanteshwara@broadcom.com,
	martin.petersen@oracle.com, megaraidlinux.pdl@broadcom.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: megaraid_mbox: return -ENOMEM on megaraid_init_mbox() allocation failure
Date: Tue, 19 Oct 2021 07:44:08 -0400	[thread overview]
Message-ID: <2482854e18365087266c2f0907c1bbfd42bd2731.camel@linux.ibm.com> (raw)
In-Reply-To: <1634640800-22502-1-git-send-email-jiapeng.chong@linux.alibaba.com>

On Tue, 2021-10-19 at 18:53 +0800, Jiapeng Chong wrote:
> From: chongjiapeng <jiapeng.chong@linux.alibaba.com>
> 
> Fixes the following smatch warning:
> 
> drivers/scsi/megaraid/megaraid_mbox.c:715 megaraid_init_mbox() warn:
> returning -1 instead of -ENOMEM is sloppy.

Why is this a problem?  megaraid_init_mbox() is called using this
pattern:

	// Start the mailbox based controller
	if (megaraid_init_mbox(adapter) != 0) {
		con_log(CL_ANN, (KERN_WARNING
			"megaraid: mailbox adapter did not initialize\n"));

		goto out_free_adapter;
	}

So the only meaningful returns are 0 on success and anything else
(although megaraid uses -1 for this) on failure.   Since -1 is the
conventional failure return, why alter that to something different that
still won't be printed or acted on?  And worse still, if we make this
change, it will likely excite other static checkers to complain we're
losing error information ...

James



  reply	other threads:[~2021-10-19 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 10:53 Jiapeng Chong
2021-10-19 11:44 ` James Bottomley [this message]
2021-10-20  2:56   ` Finn Thain
2021-10-20 12:13     ` James Bottomley
2021-10-20 22:50       ` Finn Thain

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=2482854e18365087266c2f0907c1bbfd42bd2731.camel@linux.ibm.com \
    --to=jejb@linux.ibm.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.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®