From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerhard Sittig Subject: Re: [PATCH] spi: Always check complete callback before calling it Date: Wed, 2 Apr 2014 21:04:51 +0200 Message-ID: <20140402190451.GE11339@book.gsilab.sittig.org> References: <1396448464.8891.1.camel@phoenix> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mark Brown , Hou Zhiqiang , Sebastian Andrzej Siewior , Grant Likely , Yoshihiro Shimoda , Atsushi Nemoto , linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Axel Lin Return-path: Content-Disposition: inline In-Reply-To: <1396448464.8891.1.camel@phoenix> Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Wed, 2014-04-02 at 22:21 +0800, Axel Lin wrote: > > Since commit 1e25cd4729bd "spi: Do not require a completion", this checking is > required to prevent NULL pointer dereference. > > Signed-off-by: Axel Lin > [ ... ] > --- a/drivers/spi/spi-mpc512x-psc.c > +++ b/drivers/spi/spi-mpc512x-psc.c > @@ -300,7 +300,8 @@ static int mpc512x_psc_spi_msg_xfer(struct spi_master *master, > } > > m->status = status; > - m->complete(m->context); > + if (m->complete) > + m->complete(m->context); > > if (status || !cs_change) > mpc512x_psc_spi_deactivate_cs(spi); Haven't run-tested the change, but assuming that the .complete() member became optional, the change is straight forward for it. Looks good to me. virtually yours Gerhard Sittig -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office-ynQEQJNshbs@public.gmane.org -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html