All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Steve Wise <swise@opengridcomputing.com>, netdev@vger.kernel.org
Cc: santosh@chelsio.com, davem@davemloft.net, hariprasad@chelsio.com
Subject: Re: [PATCH 1/1] cxgb3: fix up vpd strings for kstrto*()
Date: Thu, 18 Feb 2016 16:04:39 +0300	[thread overview]
Message-ID: <56C5C167.7080205@cogentembedded.com> (raw)
In-Reply-To: <20160217233126.E0815E0753@smtp.ogc.us>

Hello.

On 2/17/2016 11:36 PM, Steve Wise wrote:

> The vpd strings are left justified, in a fixed length array, with possible
> trailing white space and no NUL.  So fix them up before calling kstrto*().
>
> This is a recent regression which causes cxgb3 to fail to load.
>
> Fixes:e72c932('cxgb3: Convert simple_strtoul to kstrtox')
>
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
> ---
>   drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 32 +++++++++++++++++++++++-------
>   1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
> index ee04caa..bfd4a7f 100644
> --- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
> +++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
> @@ -681,6 +681,24 @@ int t3_seeprom_wp(struct adapter *adapter, int enable)
>   	return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ? 0xc : 0);
>   }
>
> +static int vpdstrtouint(char *s, int len, unsigned int base, unsigned int *val)
> +{
> +	char tok[len+1];

    The Linus coding style generally requires the operators to be surrounded 
by spaces.

> +
> +	memcpy(tok, s, len);
> +	tok[len] = 0;
> +	return kstrtouint(strim(tok), base, val);
> +}
> +
> +static int vpdstrtou16(char *s, int len, unsigned int base, u16 *val)
> +{
> +	char tok[len+1];

    Likewise.

> +
> +	memcpy(tok, s, len);
> +	tok[len] = 0;
> +	return kstrtou16(strim(tok), base, val);
> +}
> +
>   /**
>    *	get_vpd_params - read VPD parameters from VPD EEPROM
>    *	@adapter: adapter to read
[...]

MBR, Sergei

      reply	other threads:[~2016-02-18 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 20:36 [PATCH 1/1] cxgb3: fix up vpd strings for kstrto*() Steve Wise
2016-02-18 13:04 ` Sergei Shtylyov [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=56C5C167.7080205@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=hariprasad@chelsio.com \
    --cc=netdev@vger.kernel.org \
    --cc=santosh@chelsio.com \
    --cc=swise@opengridcomputing.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.