[1/1] scsi: pm8001: remove unnecessary oom message

Message ID 20210610082010.16507-1-thunder.leizhen@huawei.com
State Superseded
Headers show
Series
  • [1/1] scsi: pm8001: remove unnecessary oom message
Related show

Commit Message

Zhen Lei June 10, 2021, 8:20 a.m.
Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Remove it can help us save a bit of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

---
 drivers/scsi/pm8001/pm8001_sas.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.26.0.106.g9fadedd

Comments

Jinpu Wang June 10, 2021, 8:59 a.m. | #1
On Thu, Jun 10, 2021 at 10:20 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
>

> Fixes scripts/checkpatch.pl warning:

> WARNING: Possible unnecessary 'out of memory' message

>

> Remove it can help us save a bit of memory.

>

> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

> ---

>  drivers/scsi/pm8001/pm8001_sas.c | 4 +---

>  1 file changed, 1 insertion(+), 3 deletions(-)

>

> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c

> index 6860d5a9ef83b44..fff01a6effc4dab 100644

> --- a/drivers/scsi/pm8001/pm8001_sas.c

> +++ b/drivers/scsi/pm8001/pm8001_sas.c

> @@ -118,10 +118,8 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,

>                 align_offset = (dma_addr_t)align - 1;

>         mem_virt_alloc = dma_alloc_coherent(&pdev->dev, mem_size + align,

>                                             &mem_dma_handle, GFP_KERNEL);

> -       if (!mem_virt_alloc) {

> -               pr_err("pm80xx: memory allocation error\n");

> +       if (!mem_virt_alloc)

>                 return -1;

> -       }

while you are at it, can you also fix the return code to -ENOMEM


Thanks.
Zhen Lei June 10, 2021, 9:18 a.m. | #2
On 2021/6/10 16:59, Jinpu Wang wrote:
> On Thu, Jun 10, 2021 at 10:20 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:

>>

>> Fixes scripts/checkpatch.pl warning:

>> WARNING: Possible unnecessary 'out of memory' message

>>

>> Remove it can help us save a bit of memory.

>>

>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

>> ---

>>  drivers/scsi/pm8001/pm8001_sas.c | 4 +---

>>  1 file changed, 1 insertion(+), 3 deletions(-)

>>

>> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c

>> index 6860d5a9ef83b44..fff01a6effc4dab 100644

>> --- a/drivers/scsi/pm8001/pm8001_sas.c

>> +++ b/drivers/scsi/pm8001/pm8001_sas.c

>> @@ -118,10 +118,8 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,

>>                 align_offset = (dma_addr_t)align - 1;

>>         mem_virt_alloc = dma_alloc_coherent(&pdev->dev, mem_size + align,

>>                                             &mem_dma_handle, GFP_KERNEL);

>> -       if (!mem_virt_alloc) {

>> -               pr_err("pm80xx: memory allocation error\n");

>> +       if (!mem_virt_alloc)

>>                 return -1;

>> -       }

> while you are at it, can you also fix the return code to -ENOMEM


OK, I will update it.

> 

> 

> Thanks.

> 

> .

>

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 6860d5a9ef83b44..fff01a6effc4dab 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -118,10 +118,8 @@  int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
 		align_offset = (dma_addr_t)align - 1;
 	mem_virt_alloc = dma_alloc_coherent(&pdev->dev, mem_size + align,
 					    &mem_dma_handle, GFP_KERNEL);
-	if (!mem_virt_alloc) {
-		pr_err("pm80xx: memory allocation error\n");
+	if (!mem_virt_alloc)
 		return -1;
-	}
 	*pphys_addr = mem_dma_handle;
 	phys_align = (*pphys_addr + align_offset) & ~align_offset;
 	*virt_addr = (void *)mem_virt_alloc + phys_align - *pphys_addr;