* [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open()
@ 2017-08-07 16:06 SF Markus Elfring
2017-08-07 16:08 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2017-08-07 16:06 UTC (permalink / raw)
To: Jens Axboe, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 7 Aug 2017 17:56:53 +0200
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/block/z2ram.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 41c95c9b2ab4..66af886cb0a0 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -199,12 +199,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
z2ram_map =
kmalloc((size/Z2RAM_CHUNKSIZE)*sizeof(z2ram_map[0]),
GFP_KERNEL);
- if ( z2ram_map = NULL )
- {
- printk( KERN_ERR DEVICE_NAME
- ": cannot get mem for z2ram_map\n" );
+ if (!z2ram_map)
goto err_out;
- }
while (size) {
z2ram_map[ z2ram_size++ ] = vaddr;
@@ -224,12 +220,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
case Z2MINOR_COMBINED:
z2ram_map = kmalloc( max_z2_map + max_chip_map, GFP_KERNEL );
- if ( z2ram_map = NULL )
- {
- printk( KERN_ERR DEVICE_NAME
- ": cannot get mem for z2ram_map\n" );
+ if (!z2ram_map)
goto err_out;
- }
get_z2ram();
get_chipram();
@@ -245,12 +237,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
case Z2MINOR_Z2ONLY:
z2ram_map = kmalloc( max_z2_map, GFP_KERNEL );
- if ( z2ram_map = NULL )
- {
- printk( KERN_ERR DEVICE_NAME
- ": cannot get mem for z2ram_map\n" );
+ if (!z2ram_map)
goto err_out;
- }
get_z2ram();
@@ -263,12 +251,8 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
case Z2MINOR_CHIPONLY:
z2ram_map = kmalloc( max_chip_map, GFP_KERNEL );
- if ( z2ram_map = NULL )
- {
- printk( KERN_ERR DEVICE_NAME
- ": cannot get mem for z2ram_map\n" );
+ if (!z2ram_map)
goto err_out;
- }
get_chipram();
--
2.13.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open()
2017-08-07 16:06 [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open() SF Markus Elfring
@ 2017-08-07 16:08 ` Jens Axboe
2017-08-07 16:43 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2017-08-07 16:08 UTC (permalink / raw)
To: SF Markus Elfring, kernel-janitors; +Cc: LKML
On 08/07/2017 10:06 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 7 Aug 2017 17:56:53 +0200
>
> Omit extra messages for a memory allocation failure in this function.
Please stop sending these, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open()
2017-08-07 16:08 ` Jens Axboe
@ 2017-08-07 16:43 ` Joe Perches
2017-08-07 16:44 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2017-08-07 16:43 UTC (permalink / raw)
To: Jens Axboe, SF Markus Elfring, kernel-janitors; +Cc: LKML
On Mon, 2017-08-07 at 10:08 -0600, Jens Axboe wrote:
> On 08/07/2017 10:06 AM, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Mon, 7 Aug 2017 17:56:53 +0200
> >
> > Omit extra messages for a memory allocation failure in this function.
>
> Please stop sending these, thanks.
It would be pretty funny if Markus actually had a working
Amiga / Zorro II board running the latest kernel and had
actually tested this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open()
2017-08-07 16:43 ` Joe Perches
@ 2017-08-07 16:44 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2017-08-07 16:44 UTC (permalink / raw)
To: Joe Perches, SF Markus Elfring, kernel-janitors; +Cc: LKML
On 08/07/2017 10:43 AM, Joe Perches wrote:
> On Mon, 2017-08-07 at 10:08 -0600, Jens Axboe wrote:
>> On 08/07/2017 10:06 AM, SF Markus Elfring wrote:
>>> From: Markus Elfring <elfring@users.sourceforge.net>
>>> Date: Mon, 7 Aug 2017 17:56:53 +0200
>>>
>>> Omit extra messages for a memory allocation failure in this function.
>>
>> Please stop sending these, thanks.
>
> It would be pretty funny if Markus actually had a working
> Amiga / Zorro II board running the latest kernel and had
> actually tested this patch.
Doesn't look like he even compiles then. Which means that the investment
I have to make in reviewing them is that much greater, it's just not
worth it.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-07 16:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 16:06 [PATCH] z2ram: Delete four error messages for a failed memory allocation in z2_open() SF Markus Elfring
2017-08-07 16:08 ` Jens Axboe
2017-08-07 16:43 ` Joe Perches
2017-08-07 16:44 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox