From patchwork Fri Aug 11 14:17:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 109881 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp976555qge; Fri, 11 Aug 2017 07:19:26 -0700 (PDT) X-Received: by 10.98.103.11 with SMTP id b11mr16119640pfc.211.1502461166113; Fri, 11 Aug 2017 07:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502461166; cv=none; d=google.com; s=arc-20160816; b=Mwv8dRJkFwuvvb67BaMJL/+CFmXOYXrss+76oiDNZF0ZYDmJU6KnL66HT5wCmt/VPd R55/kGvWdHo5M1mxDJrq+civo+gtvegRQWFxnmdoGT3gP48Z9klRKeyqSmeK/QHGglSg CB10e5BX01Pu6vH4L9jHUzqObSdWLCh3pKq1L0aSz6j2v+Wd8q+UDd4eaZOuhWP8v2Xy 2tH/a4HerJiixYPk3Myp2j5mO2+XFlMnxk0gjgqQTYLVrYw0Kk6j/wA7OpIblzAslDnU nAD92nCcAFn6istGTbfJfE6F7NNdJYiIwbXMe3biyWpKB3XhT65/YIExfqVRwH4VHIQZ Of9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=UoAL8i8yiSRA5MuO33W6BzTWoa37g6HIv+MaxLFZShg=; b=TpdraezUi7pH24t7nMYskGzuJpHiMYDwAT594lQfLEpbZcyTuICzYVJtGus7y+yrBc MyMXaxrBNVvEzOQ+njHVJwdBwF84G8XxXnsUzYzNn2a0IjhNNR0KoosdugbfGqJftoeq vF+UI5OW/9/HGBRXuTbTXuGMNgWYa5bESjQSacH14trjPdhe0gXNkXBuh4TuqGYogL+4 xWe02z/6D9050vJKgfeB7srnubVyVkSDa3USYCKlubuRGP9FLZkSRBdI0DJ3mdWfkbBN KcZYzMzg1ayn9yfuCis3JWkTR2+tXZ07bdCkS6ExfbISjMrKAesUSMX7c7tY0+2bBGhl x49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ERMN7xdI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 186si558763pgi.183.2017.08.11.07.19.25; Fri, 11 Aug 2017 07:19:26 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ERMN7xdI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbdHKOTX (ORCPT + 25 others); Fri, 11 Aug 2017 10:19:23 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35979 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbdHKOSn (ORCPT ); Fri, 11 Aug 2017 10:18:43 -0400 Received: by mail-wm0-f44.google.com with SMTP id t201so42917748wmt.1 for ; Fri, 11 Aug 2017 07:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UoAL8i8yiSRA5MuO33W6BzTWoa37g6HIv+MaxLFZShg=; b=ERMN7xdIKedctF0PGNI08mMaR/s8oFciXPa+rnLZ33D0oMrtcmhsIWKVYNV1jzq5fV GpC/gHbfP8Ks4/n04M975MpIYM4aPD3nrJOsEukhmuQaKb3PZSK2R6DLXUbwexzhmYoc c8EMQmwkshdkyVNvgOO/8mXfEniniNo6snJKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UoAL8i8yiSRA5MuO33W6BzTWoa37g6HIv+MaxLFZShg=; b=XYRyzt5uIrkAeUXfh74JoYSgOQXgVKLBqWBRO2CYi6PucuddOte0AbunIakGemLLb3 UgB40PlUzyt1+WtD1/ZPS++tAHX44jLNGhCK+ogt8yJLqBJ8oRTpfQXaJ6RM5FuxrDLw lFM9LB4bAdoNl9D09d5OJ0iQJJ4LZqkhCfgXI0Om/d/PbBmlKEKVcrmvsIbTa7VAEoke GoFURxu9OlBEWUh6yFTcBUQypZMtfBMAtY7fCNmZQroTZxBe1q7jvUYIcSoSp543xvN9 aAdoJLRC5mE7ic077/MI36AH9M4B3lR96HjXDY6McM56PDkO5gBzdz1MJPiUH2LZwhfh ZgDQ== X-Gm-Message-State: AHYfb5jXE357RhpmLUN8GnKr1+sHsKJ0vRiorbgwDcwPvae79WqRc0mN xCsWnQr97hammUes X-Received: by 10.28.32.208 with SMTP id g199mr9064119wmg.180.1502461122632; Fri, 11 Aug 2017 07:18:42 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:e0e8:7a5e:bd6d:f842]) by smtp.gmail.com with ESMTPSA id v22sm868383wra.70.2017.08.11.07.18.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Aug 2017 07:18:42 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Cc: dingtianhong@huawei.com, matt.redfearn@imgtec.com, dan.carpenter@oracle.com, garsilva@embeddedor.com, mka@chromium.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL Date: Fri, 11 Aug 2017 16:17:39 +0200 Message-Id: <1502461061-28065-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502461061-28065-1-git-send-email-daniel.lezcano@linaro.org> References: <20170811141520.GA795@mai> <1502461061-28065-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter The current code checks the return value of the of_io_request_and_map() function as it was returning a NULL pointer in case of error. However, it returns an error code encoded in the pointer return value, not a NULL value. Fix this by checking the returned pointer against IS_ERR() and return the error with PTR_ERR(). Signed-off-by: Dan Carpenter Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c index d509b50..4d7aef9 100644 --- a/drivers/clocksource/timer-of.c +++ b/drivers/clocksource/timer-of.c @@ -128,9 +128,9 @@ static __init int timer_base_init(struct device_node *np, const char *name = of_base->name ? of_base->name : np->full_name; of_base->base = of_io_request_and_map(np, of_base->index, name); - if (!of_base->base) { + if (IS_ERR(of_base->base)) { pr_err("Failed to iomap (%s)\n", name); - return -ENXIO; + return PTR_ERR(of_base->base); } return 0;