All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Rabin Vincent <rabin.vincent-VrBV9hrLPhE@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rabin Vincent <rabinv-VrBV9hrLPhE@public.gmane.org>
Subject: Re: [PATCH] spi: pl022: don't use uninitialized variable
Date: Thu, 6 Apr 2017 11:55:02 +0100	[thread overview]
Message-ID: <20170406105502.baaj4c2xcetp5z6p@sirena.org.uk> (raw)
In-Reply-To: <1491466583-6121-1-git-send-email-rabin.vincent-VrBV9hrLPhE@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

On Thu, Apr 06, 2017 at 10:16:23AM +0200, Rabin Vincent wrote:
> From: Rabin Vincent <rabinv-VrBV9hrLPhE@public.gmane.org>
> 
> The num-cs property is a required property according to the binding
> documentation.  However, if it is not present, the driver currently
> simply uses random junk from the stack for the num-cs since the variable
> whose pointer is passed to of_property_read_u32() is not initialized.

> @@ -2074,7 +2074,7 @@ pl022_platform_data_dt_get(struct device *dev)
>  {
>  	struct device_node *np = dev->of_node;
>  	struct pl022_ssp_controller *pd;
> -	u32 tmp;
> +	u32 tmp = 0;
>  
>  	if (!np) {
>  		dev_err(dev, "no dt node defined\n");

This shuts the warning up but since it's a required property shouldn't
we be failing the probe instead of using the value?  Looking at the code
we end up actually doing that since we end up with zero chipselects
which is flagged as an error during the main probe but it'd be good to
note this in the changelog since it looks like we just silently ignore
the required property.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2017-04-06 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06  8:16 [PATCH] spi: pl022: don't use uninitialized variable Rabin Vincent
     [not found] ` <1491466583-6121-1-git-send-email-rabin.vincent-VrBV9hrLPhE@public.gmane.org>
2017-04-06 10:55   ` Mark Brown [this message]
     [not found]     ` <20170406105502.baaj4c2xcetp5z6p-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-04-06 11:39       ` Rabin Vincent
     [not found]         ` <20170406113924.GA7801-VrBV9hrLPhE@public.gmane.org>
2017-04-06 18:12           ` Mark Brown
2017-04-06 10:58   ` Applied "spi: pl022: don't use uninitialized variable" to the spi tree Mark Brown

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=20170406105502.baaj4c2xcetp5z6p@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rabin.vincent-VrBV9hrLPhE@public.gmane.org \
    --cc=rabinv-VrBV9hrLPhE@public.gmane.org \
    /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.