From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"dgilbert@interlog.com" <dgilbert@interlog.com>
Cc: "James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"hare@suse.de" <hare@suse.de>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Subject: Re: [PATCH] scsi_debug: add cdb_len parameter
Date: Tue, 21 Nov 2017 16:48:34 +0000 [thread overview]
Message-ID: <1511282912.2692.8.camel@wdc.com> (raw)
In-Reply-To: <20171116043650.18903-1-dgilbert@interlog.com>
On Wed, 2017-11-15 at 23:36 -0500, Douglas Gilbert wrote:
> -#define SDEBUG_VERSION "1.86"
> -static const char *sdebug_version_date = "20160430";
> +#define SDEBUG_VERSION "1.87"
> +static const char *sdebug_version_date = "20171105";
Is this kind of version information really useful for an upstream driver? Can
this version information be removed?
> +static void all_config_cdb_len(void)
> +{
> + struct sdebug_host_info *sdbg_host;
> + struct Scsi_Host *shost;
> + struct scsi_device *sdev;
> +
> +
> + spin_lock(&sdebug_host_list_lock);
A minor remark, but anyway: other kernel code only uses a single blank line
between declarations and code.
> +static ssize_t cdb_len_store(struct device_driver *ddp, const char *buf,
> + size_t count)
> +{
> + int n;
> +
> + if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) {
> + sdebug_cdb_len = n;
> + all_config_cdb_len();
> + return count;
> + }
> + return -EINVAL;
> +}
Checkpatch should have recommended to use kstrtoint() instead of sscanf().
The count check is not necessary since the buffer passed to sysfs store
functions is '\0'-terminated. Additionally, please do not use parentheses if
these are not necessary. The approach used in most parts of the kernel to
handle errors is the opposite of the above, namely:
error = /* process inputs */
if (error)
return error;
/* actual processing code */
Please consider to follow that style.
Thanks,
Bart.
prev parent reply other threads:[~2017-11-21 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-16 4:36 [PATCH] scsi_debug: add cdb_len parameter Douglas Gilbert
2017-11-21 16:48 ` Bart Van Assche [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=1511282912.2692.8.camel@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dgilbert@interlog.com \
--cc=hare@suse.de \
--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;
as well as URLs for NNTP newsgroup(s).