On Mon, Jul 24, 2017 at 09:39:32AM +0000, Qiang Zhao wrote: > On Mon 7/24/2017 3:04 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> > > > -----Original Message----- > > From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx] > > Sent: Monday, July 24, 2017 3:04 PM > > To: Qiang Zhao <qiang.zhao@xxxxxxx> > > Cc: Leo Li <leoyang.li@xxxxxxx>; linuxppc-dev@xxxxxxxxxxxxxxxx; kernel- > > janitors@xxxxxxxxxxxxxxx > > Subject: Re: [PATCH 1/2] fsl/qe: NULL dereference on error in > > ucc_of_parse_tdm() > > > > On Mon, Jul 24, 2017 at 02:24:14AM +0000, Qiang Zhao wrote: > > > On Sat 7/22/2017 3:34 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> > > wrote: > > > > > > > -----Original Message----- > > > > From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx] > > > > Sent: Saturday, July 22, 2017 3:34 PM > > > > To: Qiang Zhao <qiang.zhao@xxxxxxx> > > > > Cc: Leo Li <leoyang.li@xxxxxxx>; linuxppc-dev@xxxxxxxxxxxxxxxx; > > > > kernel- janitors@xxxxxxxxxxxxxxx > > > > Subject: [PATCH 1/2] fsl/qe: NULL dereference on error in > > > > ucc_of_parse_tdm() > > > > > > > > If "pdev = of_find_device_by_node(np2);" fails then it would lead to > > > > a NULL dereference. This function is called from probe() and we're > > > > using managed resources so we can just return without doing a manual > > cleanup. > > > > > > You mean it will be cleaned up automatically? > > > > Yes. At module unload. > > Do you mean when insmod it as a module, and when this module is removed, it will be cleaned up automatically? > Do I understand correctly? > Well, how about build-in? > Sorry, I mispoke. It's not really at module unload time. In this case it's removed automatically when probe() fails, but normally devm_ resources get released after the ->remove(). The devres_release_all() function is what releases these, so do a search for that function to see the details. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html