From patchwork Wed Sep 30 10:08:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 54294 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 5719722E23 for ; Wed, 30 Sep 2015 10:08:54 +0000 (UTC) Received: by labjk1 with SMTP id jk1sf19110639lab.0 for ; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=4zyzRybFji60vA2j+HZKnNgAYElplRP2Ubb7iDZtB1o=; b=YRuGJD0ik5KAh9Eh64GHqqaApPQ94SjVYIBOstmSLlOrTTS0s1UxyIAnS3QkGSzjoo 9zX25wyjKcM8ObBFVpEBiWQmreXH5jIG5ruu4yVF8Oskk4fklFkKFfWEyxNmBkdTBYtk 5URQgPkWePCrRTX29TbD6ZC/wJbmag4GdUQVETWTiFiYCZH9rEsHEenV7HQeQ/kuzq+N 0GReE9+4FTnXga1WEgEdufZUfD6NvSNsG6175RQt5/owQbz4Lg8/2f/dKo4z4ctCH14A ARp7NE6z9A4hpi9eHywowt+rgTDMg1VatExTQqIbcWE9pL+4Im/6fzYUt1vkNEZH0mT8 3+qQ== X-Gm-Message-State: ALoCoQkpPeOpracyK+DlV1XSAVEJ/+m/T9YLcoZ0p1S5V8sgSaUC1lWKuSCjhJRTQ5f02dw6tzct X-Received: by 10.152.120.232 with SMTP id lf8mr400528lab.1.1443607733326; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.164 with SMTP id t4ls64334lat.84.gmail; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) X-Received: by 10.112.125.231 with SMTP id mt7mr831961lbb.87.1443607733155; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id s70si149140lfs.93.2015.09.30.03.08.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 03:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by laer8 with SMTP id r8so39776133lae.2 for ; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) X-Received: by 10.152.28.73 with SMTP id z9mr880328lag.73.1443607733031; Wed, 30 Sep 2015 03:08:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2647476lbq; Wed, 30 Sep 2015 03:08:51 -0700 (PDT) X-Received: by 10.66.219.74 with SMTP id pm10mr3916209pac.93.1443607731865; Wed, 30 Sep 2015 03:08:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yx8si465941pac.182.2015.09.30.03.08.51; Wed, 30 Sep 2015 03:08:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756190AbbI3KIt (ORCPT + 30 others); Wed, 30 Sep 2015 06:08:49 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:33188 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756070AbbI3KIr (ORCPT ); Wed, 30 Sep 2015 06:08:47 -0400 Received: by wiclk2 with SMTP id lk2so190104682wic.0 for ; Wed, 30 Sep 2015 03:08:46 -0700 (PDT) X-Received: by 10.180.101.138 with SMTP id fg10mr3907836wib.1.1443607726080; Wed, 30 Sep 2015 03:08:46 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id ld5sm424677wjc.18.2015.09.30.03.08.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 03:08:45 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux@arm.linux.org.uk, Heiko Stuebner , linux-kernel@vger.kernel.org (open list:CLOCKSOURCE, CLOC...), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC...), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC...) Subject: [PATCH 1/2] clocksource/drivers/rockchip: Fix bad NO_IRQ usage Date: Wed, 30 Sep 2015 12:08:29 +0200 Message-Id: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <560BB452.1020000@linaro.org> References: <560BB452.1020000@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The current code assumes the 'irq_of_parse_and_map' will return NO_IRQ in case of failure. Unfortunately, the NO_IRQ is not consistent across the different architectures and we must not rely on it. NO_IRQ is equal to '-1' on ARM and 'irq_of_parse_and_map' returns '0' in case of an error. Hence, the latter won't be detected and will lead to a crash. Fix this by just checking 'irq' is different from zero. Signed-off-by: Daniel Lezcano --- drivers/clocksource/rockchip_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index bb2c2b0..d3c1742 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c @@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np) bc_timer.freq = clk_get_rate(timer_clk); irq = irq_of_parse_and_map(np, 0); - if (irq == NO_IRQ) { + if (!irq) { pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME); return; }