From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbbEBPGM (ORCPT ); Sat, 2 May 2015 11:06:12 -0400 Received: from down.free-electrons.com ([37.187.137.238]:33230 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751948AbbEBPFH (ORCPT ); Sat, 2 May 2015 11:05:07 -0400 From: Maxime Ripard To: linux-kernel@vger.kernel.org Cc: Maxime Ripard , Daniel Lezcano , Thomas Gleixner Subject: [PATCH 5/6] clocksource: sun5i: Fix of_io_request_and_map error check Date: Sat, 2 May 2015 17:03:25 +0200 Message-Id: <1430579006-32702-6-git-send-email-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.3.6 In-Reply-To: <1430579006-32702-1-git-send-email-maxime.ripard@free-electrons.com> References: <1430579006-32702-1-git-send-email-maxime.ripard@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_io_request_and map returns an error pointer, but the current code assumes that on error the returned pointer will be NULL. Obviously, that makes the check completely useless. Change the test to actually check for the proper error code. Signed-off-by: Maxime Ripard Cc: Daniel Lezcano Cc: Thomas Gleixner --- drivers/clocksource/timer-sun5i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index 28aa4b7bb602..0ffb4ea7c925 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -324,7 +324,7 @@ static void __init sun5i_timer_init(struct device_node *node) int irq; timer_base = of_io_request_and_map(node, 0, of_node_full_name(node)); - if (!timer_base) + if (IS_ERR(timer_base)) panic("Can't map registers"); irq = irq_of_parse_and_map(node, 0); -- 2.3.6