[03/10] bus/dpaa: fix management command init calling
Checks
Commit Message
'bm_mc_init' only return 0, but the function whicl calls int
check the negative ret, and this is redundant.
This patch fixed it by not checking the return value.
Fixes: f38f61e982f8 ("bus/dpaa: add BMAN hardware interfaces")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/bus/dpaa/base/qbman/bman.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
On 4/19/21 4:34 PM, Min Hu (Connor) wrote:
> 'bm_mc_init' only return 0, but the function whicl calls int
> check the negative ret, and this is redundant.
>
> This patch fixed it by not checking the return value.
>
> Fixes: f38f61e982f8 ("bus/dpaa: add BMAN hardware interfaces")
> Cc: stable@dpdk.org
>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> drivers/bus/dpaa/base/qbman/bman.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/dpaa/base/qbman/bman.c b/drivers/bus/dpaa/base/qbman/bman.c
> index 8a62907..e1ba2a8 100644
> --- a/drivers/bus/dpaa/base/qbman/bman.c
> +++ b/drivers/bus/dpaa/base/qbman/bman.c
> @@ -70,10 +70,8 @@ struct bman_portal *bman_create_portal(struct bman_portal *portal,
> pr_err("Bman RCR initialisation failed\n");
> return NULL;
> }
> - if (bm_mc_init(p)) {
> - pr_err("Bman MC initialisation failed\n");
> - goto fail_mc;
> - }
> + (void)bm_mc_init(p);
> +
As I understand compiler can do it for you and there is no
point to break the code in the case of future changes if
bm_mc_init() starts to return errors.
> portal->pools = kmalloc(2 * sizeof(*pools), GFP_KERNEL);
> if (!portal->pools)
> goto fail_pools;
>
在 2021/4/20 17:35, Andrew Rybchenko 写道:
> On 4/19/21 4:34 PM, Min Hu (Connor) wrote:
>> 'bm_mc_init' only return 0, but the function whicl calls int
>> check the negative ret, and this is redundant.
>>
>> This patch fixed it by not checking the return value.
>>
>> Fixes: f38f61e982f8 ("bus/dpaa: add BMAN hardware interfaces")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>> drivers/bus/dpaa/base/qbman/bman.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/bus/dpaa/base/qbman/bman.c b/drivers/bus/dpaa/base/qbman/bman.c
>> index 8a62907..e1ba2a8 100644
>> --- a/drivers/bus/dpaa/base/qbman/bman.c
>> +++ b/drivers/bus/dpaa/base/qbman/bman.c
>> @@ -70,10 +70,8 @@ struct bman_portal *bman_create_portal(struct bman_portal *portal,
>> pr_err("Bman RCR initialisation failed\n");
>> return NULL;
>> }
>> - if (bm_mc_init(p)) {
>> - pr_err("Bman MC initialisation failed\n");
>> - goto fail_mc;
>> - }
>> + (void)bm_mc_init(p);
>> +
>
> As I understand compiler can do it for you and there is no
> point to break the code in the case of future changes if
> bm_mc_init() starts to return errors.
>
Agreed, this patch can be abandoned.
>> portal->pools = kmalloc(2 * sizeof(*pools), GFP_KERNEL);
>> if (!portal->pools)
>> goto fail_pools;
>>
>
> .
>
@@ -70,10 +70,8 @@ struct bman_portal *bman_create_portal(struct bman_portal *portal,
pr_err("Bman RCR initialisation failed\n");
return NULL;
}
- if (bm_mc_init(p)) {
- pr_err("Bman MC initialisation failed\n");
- goto fail_mc;
- }
+ (void)bm_mc_init(p);
+
portal->pools = kmalloc(2 * sizeof(*pools), GFP_KERNEL);
if (!portal->pools)
goto fail_pools;