From: David Brownell <david-b@pacbell.net>
To: Julia Lawall <julia@diku.dk>
Cc: spi-devel-general@lists.sourceforge.net,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 10/11] drivers/spi: Move a dereference below a NULL test
Date: Wed, 17 Dec 2008 12:22:23 -0800 [thread overview]
Message-ID: <200812171222.23785.david-b@pacbell.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0812161615090.20444@pc-004.diku.dk>
On Tuesday 16 December 2008, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> In each case, if the NULL test is necessary, then the dereference should be
> moved below the NULL test.
>
> The semantic patch that makes this change is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @@
> type T;
> expression E;
> identifier i,fld;
> statement S;
> @@
>
> - T i = E->fld;
> + T i;
> ... when != E
> when != i
> if (E == NULL) S
> + i = E->fld;
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
... and I'm *still* glad to see tools shaking loose
goofage like this. :)
>
> ---
> drivers/spi/pxa2xx_spi.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
> index cf12f2d..fbad7e4 100644
> --- a/drivers/spi/pxa2xx_spi.c
> +++ b/drivers/spi/pxa2xx_spi.c
> @@ -1561,11 +1561,12 @@ out_error_master_alloc:
> static int pxa2xx_spi_remove(struct platform_device *pdev)
> {
> struct driver_data *drv_data = platform_get_drvdata(pdev);
> - struct ssp_device *ssp = drv_data->ssp;
> + struct ssp_device *ssp;
> int status = 0;
>
> if (!drv_data)
> return 0;
> + ssp = drv_data->ssp;
>
> /* Remove the queue */
> status = destroy_queue(drv_data);
>
>
prev parent reply other threads:[~2008-12-17 20:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-16 15:15 Julia Lawall
2008-12-17 20:22 ` David Brownell [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=200812171222.23785.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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®