diff mbox series

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

Message ID 20210610094605.16672-2-thunder.leizhen@huawei.com
State New
Headers show
Series scsi: pm8001: remove unnecessary oom message | expand

Commit Message

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

Remove it can help us save a bit of memory.

By the way, change the return error code from "-1" to "-ENOMEM".

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

---
 drivers/scsi/pm8001/pm8001_sas.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.26.0.106.g9fadedd

Comments

Jinpu Wang June 10, 2021, 9:50 a.m. UTC | #1
On Thu, Jun 10, 2021 at 11:46 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.

>

> By the way, change the return error code from "-1" to "-ENOMEM".

>

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

Acked-by: Jack Wang <jinpu.wang@ionos.com>

Thx.
> ---

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

>  1 file changed, 2 insertions(+), 4 deletions(-)

>

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

> index 6860d5a9ef83b44..6f33d821e5453d1 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");

> -               return -1;

> -       }

> +       if (!mem_virt_alloc)

> +               return -ENOMEM;

>         *pphys_addr = mem_dma_handle;

>         phys_align = (*pphys_addr + align_offset) & ~align_offset;

>         *virt_addr = (void *)mem_virt_alloc + phys_align - *pphys_addr;

> --

> 2.26.0.106.g9fadedd

>

>
Martin K. Petersen June 16, 2021, 2:48 a.m. UTC | #2
Zhen,

> Fixes scripts/checkpatch.pl warning:

> WARNING: Possible unnecessary 'out of memory' message


Applied to 5.14/scsi-staging.

Instead of sending 20 individual patches to address OOM messages, please
submit a series. That makes things much easier to track in patchwork and
b4.

Same goes for the DEVICE_ATTR_RO changes. One series per logical change,
one patch per driver.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Zhen Lei June 16, 2021, 3:11 a.m. UTC | #3
On 2021/6/16 10:48, Martin K. Petersen wrote:
> 

> Zhen,

> 

>> Fixes scripts/checkpatch.pl warning:

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

> 

> Applied to 5.14/scsi-staging.

> 

> Instead of sending 20 individual patches to address OOM messages, please

> submit a series. That makes things much easier to track in patchwork and

> b4.


OK, I'll repost the other patches except this one as a series.

> 

> Same goes for the DEVICE_ATTR_RO changes. One series per logical change,

> one patch per driver.


OK

> 

> Thanks!

>
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 6860d5a9ef83b44..6f33d821e5453d1 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");
-		return -1;
-	}
+	if (!mem_virt_alloc)
+		return -ENOMEM;
 	*pphys_addr = mem_dma_handle;
 	phys_align = (*pphys_addr + align_offset) & ~align_offset;
 	*virt_addr = (void *)mem_virt_alloc + phys_align - *pphys_addr;