From fd1335e048a961ef63f7da1a0c8f395eb7bddc22 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 7 Aug 2017 20:09:20 +0000 Subject: block/ps3vram: Delete an error message for a failed memory allocation in ps3vram_cache_init() Omit an extra message 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 Cc: Jim Paris Cc: Jens Axboe Signed-off-by: Geoff Levand Signed-off-by: Michael Ellerman --- drivers/block/ps3vram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/block') diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index e0e81cacd781..ba97d037279e 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -409,10 +409,8 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev) priv->cache.page_size = CACHE_PAGE_SIZE; priv->cache.tags = kzalloc(sizeof(struct ps3vram_tag) * CACHE_PAGE_COUNT, GFP_KERNEL); - if (priv->cache.tags == NULL) { - dev_err(&dev->core, "Could not allocate cache tags\n"); + if (!priv->cache.tags) return -ENOMEM; - } dev_info(&dev->core, "Created ram cache: %d entries, %d KiB each\n", CACHE_PAGE_COUNT, CACHE_PAGE_SIZE / 1024); -- cgit v1.2.3 From 00e7c259e9c44f414ead5fc9bb3c459d8235045c Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Mon, 7 Aug 2017 20:09:20 +0000 Subject: block/ps3vram: Check return of ps3vram_cache_init Cc: Markus Elfring Cc: Jim Paris Cc: Jens Axboe Signed-off-by: Geoff Levand Signed-off-by: Michael Ellerman --- drivers/block/ps3vram.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/block') diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index ba97d037279e..6a55959cbf78 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -741,7 +741,11 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev) goto out_unmap_reports; } - ps3vram_cache_init(dev); + error = ps3vram_cache_init(dev); + if (error < 0) { + goto out_unmap_reports; + } + ps3vram_proc_init(dev); queue = blk_alloc_queue(GFP_KERNEL); -- cgit v1.2.3