lkml.org 
[lkml]   [2022]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] spmi: Add check for remove callback in spmi_drv_remove API
From
Hi Greg

On 12/13/2022 8:39 PM, Greg KH wrote:
> On Tue, Dec 13, 2022 at 07:12:10PM +0530, Jishnu Prakash wrote:
>> Hi Greg
>
> Hi, please do not top-post :(
>
>> These are two SPMI drivers without remove callbacks defined:
>>
>> drivers/mfd/qcom-spmi-pmic.c
>> drivers/mfd/hi6421-spmi-pmic.c
>
> Great, they should be fixed up now, right?
>

Our QCOM SPMI PMIC driver allocates resources in its probe using only
devm_() APIs and does not require any other cleanup. It doesn't seem
right to add an empty remove callback to it just to avoid this crash, it
seems the better solution architecturally is to call the remove function
only if it's defined.

In addition, I could see that other buses like PCI and AMBA do check for
the remove API being defined for their drivers before calling it:

AMBA example:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/amba/bus.c#n328

PCI example:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pci-driver.c#n474


>> We made this change after noticing an issue internally with the first one
>> above, there was a crash when trying to remove it with rmmod, which is fixed
>> by this change.
>
> Then please say that in the changelog text, otherwise we have no idea
> _why_ this is needed. All you said was "add this new check _IF_" and we
> have no idea what the answer to "if" is :(
>

I have uploaded the change with an updated title and commit text, can
you please have a look?

> thanks,
>
> greg k-h
Thanks,
Jishnu

\
 
 \ /
  Last update: 2023-03-26 23:16    [W:1.684 / U:4.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site