mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
To: Bart Van Assche <bvanassche@acm.org>, <quic_cang@quicinc.com>,
	<quic_nitirawa@quicinc.com>, <avri.altman@wdc.com>,
	<peter.wang@mediatek.com>, <manivannan.sadhasivam@linaro.org>,
	<minwoo.im@samsung.com>, <adrian.hunter@intel.com>,
	<martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Bean Huo <beanhuo@micron.com>,
	Maramaina Naresh <quic_mnaresh@quicinc.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/1] scsi: ufs: core: Support Updating UIC Command Timeout
Date: Wed, 10 Jul 2024 22:46:30 -0700	[thread overview]
Message-ID: <6f6a2608-6f1e-60dd-0dcc-93fa3d61202e@quicinc.com> (raw)
In-Reply-To: <a89910ad-da5b-42c2-8a0f-9f4908fa2c1a@acm.org>

On 7/9/2024 11:10 AM, Bart Van Assche wrote:
> On 7/8/24 11:06 PM, Bao D. Nguyen wrote:
>> +static int uic_cmd_timeout_set(const char *val, const struct 
>> kernel_param *kp)
>> +{
>> +    unsigned int n;
>> +    int ret;
>> +
>> +    ret = kstrtou32(val, 0, &n);
>> +    if (ret != 0 || n < UIC_CMD_TIMEOUT_DEFAULT || n > 
>> UIC_CMD_TIMEOUT_MAX)
>> +        return -EINVAL;
>> +
>> +    return param_set_int(val, kp);
>> +}
> 
> The above code converts 'val' twice to an integer: a first time by
> calling kstrtou32() and a second time by calling param_set_int().
> Please remove one of the two string-to-integer conversions, e.g. by
> changing "param_set_int(val, kp)" into "uic_cmd_timeout = n" or
> *(unsigned int *)kp->arg = n".
Hi Bart,
My understanding is that in the kstrtou32() function, the  the result of 
the conversion is written to the third parameter only which is '&n' in 
this case. 'val' does not get updated (and it cannot be updated because 
of its 'const' type). Please correct me if I am wrong.

Thanks, Bao

> 
> Thanks,
> 
> Bart.


  reply	other threads:[~2024-07-11  5:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1720503791.git.quic_nguyenb@quicinc.com>
2024-07-09  6:06 ` Bao D. Nguyen
2024-07-09 18:10   ` Bart Van Assche
2024-07-11  5:46     ` Bao D. Nguyen [this message]
2024-07-12  1:20       ` Bao D. Nguyen
2024-07-12 17:51         ` Bart Van Assche

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=6f6a2608-6f1e-60dd-0dcc-93fa3d61202e@quicinc.com \
    --to=quic_nguyenb@quicinc.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=minwoo.im@samsung.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_mnaresh@quicinc.com \
    --cc=quic_nitirawa@quicinc.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®