From patchwork Wed Sep 30 10:08:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 54295 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id B578622E23 for ; Wed, 30 Sep 2015 10:09:04 +0000 (UTC) Received: by laer8 with SMTP id r8sf18752056lae.2 for ; Wed, 30 Sep 2015 03:09:03 -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=ByEVoY7q4E4l8OVYxcEf3JdCs6bGEEAlO1qUYpeYHAE=; b=PNWCfa3A/dE+WpxWpwLXVMMUhk4Fy+tAFAdwb7Jl+G61c1oXZ8iH9gvhn6g33uygIn UOQq8uUeTE+w4i4qNWxPmXKetyqCgbXr9N5F5FchAcA87HGsrWu6ECu9JciCA44JGgSB ueqxr753wDL+izKHEhkIjPf54/+YXqlRJWs/Bft/iJl+PAAWcr6L4ngPUSGkX3hNivsf TI3Xi/I+ytlhOJGo5SYJlDFoxPZkvLOycI6eFo6+XkYGNEWr4jm3Hcms2C79F/PwS+8l 9KBv9IQSm+/Yf7pd+Es354ZW1aVmerOvrSV3esdAiGH3Oy27+yP7CkqLeuOKiVkMGYeo yeDA== X-Gm-Message-State: ALoCoQn4pATp6XMq1A/Z9lQKsAAyHZn4TSN0YasN8jn9Idts0MGBSczIYpNEO6nBBhx19zCPzMvY X-Received: by 10.180.12.170 with SMTP id z10mr505765wib.1.1443607743677; Wed, 30 Sep 2015 03:09:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.163.101 with SMTP id yh5ls25785lab.97.gmail; Wed, 30 Sep 2015 03:09:03 -0700 (PDT) X-Received: by 10.25.152.194 with SMTP id a185mr587862lfe.122.1443607743363; Wed, 30 Sep 2015 03:09:03 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id x6si163410lag.4.2015.09.30.03.09.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 03:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by laclj5 with SMTP id lj5so39841276lac.3 for ; Wed, 30 Sep 2015 03:09:03 -0700 (PDT) X-Received: by 10.152.23.170 with SMTP id n10mr878198laf.32.1443607743197; Wed, 30 Sep 2015 03:09:03 -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 w3csp2647563lbq; Wed, 30 Sep 2015 03:09:02 -0700 (PDT) X-Received: by 10.66.251.136 with SMTP id zk8mr3981617pac.143.1443607742139; Wed, 30 Sep 2015 03:09:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xk3si561701pab.23.2015.09.30.03.09.01; Wed, 30 Sep 2015 03:09:02 -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 S1756322AbbI3KI7 (ORCPT + 30 others); Wed, 30 Sep 2015 06:08:59 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:36053 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756200AbbI3KIx (ORCPT ); Wed, 30 Sep 2015 06:08:53 -0400 Received: by wicgb1 with SMTP id gb1so187437246wic.1 for ; Wed, 30 Sep 2015 03:08:52 -0700 (PDT) X-Received: by 10.180.187.142 with SMTP id fs14mr3686056wic.6.1443607732589; Wed, 30 Sep 2015 03:08:52 -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.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 03:08:52 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux@arm.linux.org.uk, Santosh Shilimkar , linux-arm-kernel@lists.infradead.org (moderated list:ARM/TEXAS INSTRUM...), linux-kernel@vger.kernel.org (open list:ARM/TEXAS INSTRUM...) Subject: [PATCH 2/2] clocksource/drivers/keystone: Fix bad NO_IRQ usage Date: Wed, 30 Sep 2015 12:08:30 +0200 Message-Id: <1443607710-10415-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> References: <560BB452.1020000@linaro.org> <1443607710-10415-1-git-send-email-daniel.lezcano@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.50 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 Acked-by: Santosh Shilimkar --- drivers/clocksource/timer-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c index edacf39..1cea08c 100644 --- a/drivers/clocksource/timer-keystone.c +++ b/drivers/clocksource/timer-keystone.c @@ -152,7 +152,7 @@ static void __init keystone_timer_init(struct device_node *np) int irq, error; irq = irq_of_parse_and_map(np, 0); - if (irq == NO_IRQ) { + if (!irq) { pr_err("%s: failed to map interrupts\n", __func__); return; }