From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755316AbcEEMU5 (ORCPT ); Thu, 5 May 2016 08:20:57 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34617 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbcEEMUz (ORCPT ); Thu, 5 May 2016 08:20:55 -0400 Date: Thu, 5 May 2016 17:50:49 +0530 From: Amitoj Kaur Chawla To: jassisinghbrar@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH] mailbox: Fix devm_ioremap_resource error detection code Message-ID: <20160505122049.GA9814@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure. The Coccinelle semantic patch used to make this change is as follows: @@ expression e,e1; statement S; @@ *e = devm_ioremap_resource(...); if (!e1) S Signed-off-by: Amitoj Kaur Chawla --- drivers/mailbox/mailbox-sti.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox-sti.c b/drivers/mailbox/mailbox-sti.c index 2394cfe..a334db5 100644 --- a/drivers/mailbox/mailbox-sti.c +++ b/drivers/mailbox/mailbox-sti.c @@ -430,8 +430,8 @@ static int sti_mbox_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mdev->base = devm_ioremap_resource(&pdev->dev, res); - if (!mdev->base) - return -ENOMEM; + if (IS_ERR(mdev->base)) + return PTR_ERR(mdev->base); ret = of_property_read_string(np, "mbox-name", &mdev->name); if (ret) -- 1.9.1