RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, "Du, Changbin"writes: > Hi, Balbi, > >> > Hmm, I agree from this point. I will combine this patch with other two >> patches >> > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as >> well, >> >> you are creating a dependency that doesn't exist. Please stop that. You >> should have two separate branches based on v4.6-rc3 (or, if you prefer, >> one based on my testing/fixes and another based on my testing/next). On >> one branch you have *only* $subject and you fix *all* the memory >> leaks. On the other branch you have the other two patches. >> >> Ignore the fact that we might have a conflict, that's for git (and >> maintainers) to handle when they happen. >> >> Again, don't create dependencies between fixes for the -rc cycle and >> changes for the next merge window. >> > Thanks for dedicated explanation. I was concern about the conflict. yeah, no problem ;-) > Now it is very clear for me to handle such situation. good :-) glad we could sort it out. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, "Du, Changbin" writes: > Hi, Balbi, > >> > Hmm, I agree from this point. I will combine this patch with other two >> patches >> > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as >> well, >> >> you are creating a dependency that doesn't exist. Please stop that. You >> should have two separate branches based on v4.6-rc3 (or, if you prefer, >> one based on my testing/fixes and another based on my testing/next). On >> one branch you have *only* $subject and you fix *all* the memory >> leaks. On the other branch you have the other two patches. >> >> Ignore the fact that we might have a conflict, that's for git (and >> maintainers) to handle when they happen. >> >> Again, don't create dependencies between fixes for the -rc cycle and >> changes for the next merge window. >> > Thanks for dedicated explanation. I was concern about the conflict. yeah, no problem ;-) > Now it is very clear for me to handle such situation. good :-) glad we could sort it out. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, Balbi, > > Hmm, I agree from this point. I will combine this patch with other two > patches > > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as > well, > > you are creating a dependency that doesn't exist. Please stop that. You > should have two separate branches based on v4.6-rc3 (or, if you prefer, > one based on my testing/fixes and another based on my testing/next). On > one branch you have *only* $subject and you fix *all* the memory > leaks. On the other branch you have the other two patches. > > Ignore the fact that we might have a conflict, that's for git (and > maintainers) to handle when they happen. > > Again, don't create dependencies between fixes for the -rc cycle and > changes for the next merge window. > Thanks for dedicated explanation. I was concern about the conflict. Now it is very clear for me to handle such situation. > > Is it ok for you? > > yeah, please remove root = NULL as that's completely unnecessary, but > split these patches in separate branches and fix all memory leaks. > > -- > balbi
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, Balbi, > > Hmm, I agree from this point. I will combine this patch with other two > patches > > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as > well, > > you are creating a dependency that doesn't exist. Please stop that. You > should have two separate branches based on v4.6-rc3 (or, if you prefer, > one based on my testing/fixes and another based on my testing/next). On > one branch you have *only* $subject and you fix *all* the memory > leaks. On the other branch you have the other two patches. > > Ignore the fact that we might have a conflict, that's for git (and > maintainers) to handle when they happen. > > Again, don't create dependencies between fixes for the -rc cycle and > changes for the next merge window. > Thanks for dedicated explanation. I was concern about the conflict. Now it is very clear for me to handle such situation. > > Is it ok for you? > > yeah, please remove root = NULL as that's completely unnecessary, but > split these patches in separate branches and fix all memory leaks. > > -- > balbi
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi Changbin, "Du, Changbin"writes: >> Hi, >> >> "Du, Changbin" writes: >> >> >> >> >> > +dwc->regset = NULL; >> >> >> >> >> >> setting regset to NULL is unnecessary. We only call >> dwc3_debugfs_exit() >> >> >> when removing the driver. >> >> >> >> >> >> -- >> >> >> Balbi >> >> > I'd like keep this line even it is unnecessary, because It is a good >> >> > habit to >> >> > Avoid wild pointers. Just like the dwc->root = NULL. >> >> >> >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. >> >> >> >> -- >> >> Balbi >> > I agree the dwc will be freed in current code. But the 'free' logical is >> > out >> > of the debugfs code. They should be treat as some logical independent. >> Per >> > this point, I still think set pointer to null is not bad. For example, if >> > dwc3 >> core >> > code invoke dwc3_debugfs_exit twice by mistake(just an example case, >> not >> > really), then no crash/impact for the second call. >> >> the second call should crash because it's clearly wrong ;-) If dwc3 ever >> calls dwc3_debugfs_exit() twice, it really deserves to crash. It's >> something so wrong that we want the verbosity and urgency of a kernel >> oops to make sure we fix it ASAP. >> >> If, however, we set it to null, it might be years before we notice >> anything's wrong. >> >> -- >> Balbi > > Hmm, I agree from this point. I will combine this patch with other two patches > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as well, you are creating a dependency that doesn't exist. Please stop that. You should have two separate branches based on v4.6-rc3 (or, if you prefer, one based on my testing/fixes and another based on my testing/next). On one branch you have *only* $subject and you fix *all* the memory leaks. On the other branch you have the other two patches. Ignore the fact that we might have a conflict, that's for git (and maintainers) to handle when they happen. Again, don't create dependencies between fixes for the -rc cycle and changes for the next merge window. > Is it ok for you? yeah, please remove root = NULL as that's completely unnecessary, but split these patches in separate branches and fix all memory leaks. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi Changbin, "Du, Changbin" writes: >> Hi, >> >> "Du, Changbin" writes: >> >> >> >> >> > +dwc->regset = NULL; >> >> >> >> >> >> setting regset to NULL is unnecessary. We only call >> dwc3_debugfs_exit() >> >> >> when removing the driver. >> >> >> >> >> >> -- >> >> >> Balbi >> >> > I'd like keep this line even it is unnecessary, because It is a good >> >> > habit to >> >> > Avoid wild pointers. Just like the dwc->root = NULL. >> >> >> >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. >> >> >> >> -- >> >> Balbi >> > I agree the dwc will be freed in current code. But the 'free' logical is >> > out >> > of the debugfs code. They should be treat as some logical independent. >> Per >> > this point, I still think set pointer to null is not bad. For example, if >> > dwc3 >> core >> > code invoke dwc3_debugfs_exit twice by mistake(just an example case, >> not >> > really), then no crash/impact for the second call. >> >> the second call should crash because it's clearly wrong ;-) If dwc3 ever >> calls dwc3_debugfs_exit() twice, it really deserves to crash. It's >> something so wrong that we want the verbosity and urgency of a kernel >> oops to make sure we fix it ASAP. >> >> If, however, we set it to null, it might be years before we notice >> anything's wrong. >> >> -- >> Balbi > > Hmm, I agree from this point. I will combine this patch with other two patches > (due to their dependency). And I'd like remove the 'dwc->root=NULL' as well, you are creating a dependency that doesn't exist. Please stop that. You should have two separate branches based on v4.6-rc3 (or, if you prefer, one based on my testing/fixes and another based on my testing/next). On one branch you have *only* $subject and you fix *all* the memory leaks. On the other branch you have the other two patches. Ignore the fact that we might have a conflict, that's for git (and maintainers) to handle when they happen. Again, don't create dependencies between fixes for the -rc cycle and changes for the next merge window. > Is it ok for you? yeah, please remove root = NULL as that's completely unnecessary, but split these patches in separate branches and fix all memory leaks. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> Hi, > > "Du, Changbin"writes: > >> > >> >> > + dwc->regset = NULL; > >> >> > >> >> setting regset to NULL is unnecessary. We only call > dwc3_debugfs_exit() > >> >> when removing the driver. > >> >> > >> >> -- > >> >> Balbi > >> > I'd like keep this line even it is unnecessary, because It is a good > >> > habit to > >> > Avoid wild pointers. Just like the dwc->root = NULL. > >> > >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. > >> > >> -- > >> Balbi > > I agree the dwc will be freed in current code. But the 'free' logical is out > > of the debugfs code. They should be treat as some logical independent. > Per > > this point, I still think set pointer to null is not bad. For example, if > > dwc3 > core > > code invoke dwc3_debugfs_exit twice by mistake(just an example case, > not > > really), then no crash/impact for the second call. > > the second call should crash because it's clearly wrong ;-) If dwc3 ever > calls dwc3_debugfs_exit() twice, it really deserves to crash. It's > something so wrong that we want the verbosity and urgency of a kernel > oops to make sure we fix it ASAP. > > If, however, we set it to null, it might be years before we notice > anything's wrong. > > -- > Balbi Hmm, I agree from this point. I will combine this patch with other two patches (due to their dependency). And I'd like remove the 'dwc->root=NULL' as well, Is it ok for you? Thx, Du, Changbin
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> Hi, > > "Du, Changbin" writes: > >> > >> >> > + dwc->regset = NULL; > >> >> > >> >> setting regset to NULL is unnecessary. We only call > dwc3_debugfs_exit() > >> >> when removing the driver. > >> >> > >> >> -- > >> >> Balbi > >> > I'd like keep this line even it is unnecessary, because It is a good > >> > habit to > >> > Avoid wild pointers. Just like the dwc->root = NULL. > >> > >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. > >> > >> -- > >> Balbi > > I agree the dwc will be freed in current code. But the 'free' logical is out > > of the debugfs code. They should be treat as some logical independent. > Per > > this point, I still think set pointer to null is not bad. For example, if > > dwc3 > core > > code invoke dwc3_debugfs_exit twice by mistake(just an example case, > not > > really), then no crash/impact for the second call. > > the second call should crash because it's clearly wrong ;-) If dwc3 ever > calls dwc3_debugfs_exit() twice, it really deserves to crash. It's > something so wrong that we want the verbosity and urgency of a kernel > oops to make sure we fix it ASAP. > > If, however, we set it to null, it might be years before we notice > anything's wrong. > > -- > Balbi Hmm, I agree from this point. I will combine this patch with other two patches (due to their dependency). And I'd like remove the 'dwc->root=NULL' as well, Is it ok for you? Thx, Du, Changbin
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, "Du, Changbin"writes: >> >> >> > + dwc->regset = NULL; >> >> >> >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() >> >> when removing the driver. >> >> >> >> -- >> >> Balbi >> > I'd like keep this line even it is unnecessary, because It is a good habit >> > to >> > Avoid wild pointers. Just like the dwc->root = NULL. >> >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. >> >> -- >> Balbi > I agree the dwc will be freed in current code. But the 'free' logical is out > of the debugfs code. They should be treat as some logical independent. Per > this point, I still think set pointer to null is not bad. For example, if > dwc3 core > code invoke dwc3_debugfs_exit twice by mistake(just an example case, not > really), then no crash/impact for the second call. the second call should crash because it's clearly wrong ;-) If dwc3 ever calls dwc3_debugfs_exit() twice, it really deserves to crash. It's something so wrong that we want the verbosity and urgency of a kernel oops to make sure we fix it ASAP. If, however, we set it to null, it might be years before we notice anything's wrong. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
Hi, "Du, Changbin" writes: >> >> >> > + dwc->regset = NULL; >> >> >> >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() >> >> when removing the driver. >> >> >> >> -- >> >> Balbi >> > I'd like keep this line even it is unnecessary, because It is a good habit >> > to >> > Avoid wild pointers. Just like the dwc->root = NULL. >> >> there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. >> >> -- >> Balbi > I agree the dwc will be freed in current code. But the 'free' logical is out > of the debugfs code. They should be treat as some logical independent. Per > this point, I still think set pointer to null is not bad. For example, if > dwc3 core > code invoke dwc3_debugfs_exit twice by mistake(just an example case, not > really), then no crash/impact for the second call. the second call should crash because it's clearly wrong ;-) If dwc3 ever calls dwc3_debugfs_exit() twice, it really deserves to crash. It's something so wrong that we want the verbosity and urgency of a kernel oops to make sure we fix it ASAP. If, however, we set it to null, it might be years before we notice anything's wrong. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> > >> > +dwc->regset = NULL; > >> > >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() > >> when removing the driver. > >> > >> -- > >> Balbi > > I'd like keep this line even it is unnecessary, because It is a good habit > > to > > Avoid wild pointers. Just like the dwc->root = NULL. > > there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. > > -- > Balbi I agree the dwc will be freed in current code. But the 'free' logical is out of the debugfs code. They should be treat as some logical independent. Per this point, I still think set pointer to null is not bad. For example, if dwc3 core code invoke dwc3_debugfs_exit twice by mistake(just an example case, not really), then no crash/impact for the second call. Thanks, Du, Changbin
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> > >> > +dwc->regset = NULL; > >> > >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() > >> when removing the driver. > >> > >> -- > >> Balbi > > I'd like keep this line even it is unnecessary, because It is a good habit > > to > > Avoid wild pointers. Just like the dwc->root = NULL. > > there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. > > -- > Balbi I agree the dwc will be freed in current code. But the 'free' logical is out of the debugfs code. They should be treat as some logical independent. Per this point, I still think set pointer to null is not bad. For example, if dwc3 core code invoke dwc3_debugfs_exit twice by mistake(just an example case, not really), then no crash/impact for the second call. Thanks, Du, Changbin
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
"Du, Changbin"writes: >> > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c >> > index 9ac37fe..9eeb444 100644 >> > --- a/drivers/usb/dwc3/debugfs.c >> > +++ b/drivers/usb/dwc3/debugfs.c >> > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) >> > { >> >debugfs_remove_recursive(dwc->root); >> >dwc->root = NULL; >> > + >> > + kfree(dwc->regset); >> >> we also need a kfree() on dwc3_debugfs_init(). > This patch is based on the patch set > [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void> > So, they do has dependency. :) I _did_ mention on previous set that fixes and new-features shouldn't have dependencies between them. That was the whole point of splitting the series in two. >> > + dwc->regset = NULL; >> >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() >> when removing the driver. >> >> -- >> Balbi > I'd like keep this line even it is unnecessary, because It is a good habit to > Avoid wild pointers. Just like the dwc->root = NULL. there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
"Du, Changbin" writes: >> > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c >> > index 9ac37fe..9eeb444 100644 >> > --- a/drivers/usb/dwc3/debugfs.c >> > +++ b/drivers/usb/dwc3/debugfs.c >> > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) >> > { >> >debugfs_remove_recursive(dwc->root); >> >dwc->root = NULL; >> > + >> > + kfree(dwc->regset); >> >> we also need a kfree() on dwc3_debugfs_init(). > This patch is based on the patch set > [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void> > So, they do has dependency. :) I _did_ mention on previous set that fixes and new-features shouldn't have dependencies between them. That was the whole point of splitting the series in two. >> > + dwc->regset = NULL; >> >> setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() >> when removing the driver. >> >> -- >> Balbi > I'd like keep this line even it is unnecessary, because It is a good habit to > Avoid wild pointers. Just like the dwc->root = NULL. there won't be any wild pointers here, we'll free struct dwc3 *dwc itself. -- balbi signature.asc Description: PGP signature
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c > > index 9ac37fe..9eeb444 100644 > > --- a/drivers/usb/dwc3/debugfs.c > > +++ b/drivers/usb/dwc3/debugfs.c > > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) > > { > > debugfs_remove_recursive(dwc->root); > > dwc->root = NULL; > > + > > + kfree(dwc->regset); > > we also need a kfree() on dwc3_debugfs_init(). This patch is based on the patch set [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void> So, they do has dependency. :) > > + dwc->regset = NULL; > > setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() > when removing the driver. > > -- > Balbi I'd like keep this line even it is unnecessary, because It is a good habit to Avoid wild pointers. Just like the dwc->root = NULL. Thanks, Du, Changbin
RE: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
> > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c > > index 9ac37fe..9eeb444 100644 > > --- a/drivers/usb/dwc3/debugfs.c > > +++ b/drivers/usb/dwc3/debugfs.c > > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) > > { > > debugfs_remove_recursive(dwc->root); > > dwc->root = NULL; > > + > > + kfree(dwc->regset); > > we also need a kfree() on dwc3_debugfs_init(). This patch is based on the patch set [PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void> So, they do has dependency. :) > > + dwc->regset = NULL; > > setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() > when removing the driver. > > -- > Balbi I'd like keep this line even it is unnecessary, because It is a good habit to Avoid wild pointers. Just like the dwc->root = NULL. Thanks, Du, Changbin
Re: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
changbin...@intel.com writes: > From: "Du, Changbin"> > dwc->regset is allocated on dwc3_debugfs_init, and should > be released on dwc3_debugfs_exit. > > Signed-off-by: Du, Changbin > --- > This patch is seperated from patch set: > [PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs > Because it is not related to other 2 patches. > > --- > drivers/usb/dwc3/debugfs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c > index 9ac37fe..9eeb444 100644 > --- a/drivers/usb/dwc3/debugfs.c > +++ b/drivers/usb/dwc3/debugfs.c > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) > { > debugfs_remove_recursive(dwc->root); > dwc->root = NULL; > + > + kfree(dwc->regset); we also need a kfree() on dwc3_debugfs_init(). > + dwc->regset = NULL; setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() when removing the driver. -- balbi signature.asc Description: PGP signature
Re: [PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit
changbin...@intel.com writes: > From: "Du, Changbin" > > dwc->regset is allocated on dwc3_debugfs_init, and should > be released on dwc3_debugfs_exit. > > Signed-off-by: Du, Changbin > --- > This patch is seperated from patch set: > [PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs > Because it is not related to other 2 patches. > > --- > drivers/usb/dwc3/debugfs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c > index 9ac37fe..9eeb444 100644 > --- a/drivers/usb/dwc3/debugfs.c > +++ b/drivers/usb/dwc3/debugfs.c > @@ -687,4 +687,7 @@ void dwc3_debugfs_exit(struct dwc3 *dwc) > { > debugfs_remove_recursive(dwc->root); > dwc->root = NULL; > + > + kfree(dwc->regset); we also need a kfree() on dwc3_debugfs_init(). > + dwc->regset = NULL; setting regset to NULL is unnecessary. We only call dwc3_debugfs_exit() when removing the driver. -- balbi signature.asc Description: PGP signature