Re:Re: [PATCH] crypto: Hold the reference returned by of_find_compatible_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





At 2022-06-30 14:43:21, "Herbert Xu" <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>Liang He <windhl@xxxxxxx> wrote:
>> In nx842_pseries_init() and crypto4xx_probe(), we should hold the
>> reference returned by of_find_compatible_node() and use it to call
>> of_node_put to keep refcount balance.
>> 
>> Signed-off-by: Liang He <windhl@xxxxxxx>
>> ---
>> drivers/crypto/amcc/crypto4xx_core.c  | 13 ++++++++-----
>> drivers/crypto/nx/nx-common-pseries.c |  5 ++++-
>> 2 files changed, 12 insertions(+), 6 deletions(-)
>
>Please split this into two patches.
>

OK.

>> diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
>> index 8278d98074e9..169b6a05e752 100644
>> --- a/drivers/crypto/amcc/crypto4xx_core.c
>> +++ b/drivers/crypto/amcc/crypto4xx_core.c
>> @@ -1378,6 +1378,7 @@ static int crypto4xx_probe(struct platform_device *ofdev)
>>        struct resource res;
>>        struct device *dev = &ofdev->dev;
>>        struct crypto4xx_core_device *core_dev;
>> +       struct device_node *np;
>>        u32 pvr;
>>        bool is_revb = true;
>> 
>> @@ -1385,20 +1386,20 @@ static int crypto4xx_probe(struct platform_device *ofdev)
>>        if (rc)
>>                return -ENODEV;
>> 
>> -       if (of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) {
>> +       if ((np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-crypto")) != NULL) {
>
>This is getting awkwardly long.  Please change this to
>
>	np = ...;
>	if (np) {
>
>Thanks,
>-- 
>Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
>Home Page: http://gondor.apana.org.au/~herbert/
>PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Thanks, Herbert.

I will resend two patches with above change.

Liang





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux