From patchwork Fri Jan 9 05:08:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Varka Bhadram X-Patchwork-Id: 426910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1BFBE140129 for ; Fri, 9 Jan 2015 16:13:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750928AbbAIFNI (ORCPT ); Fri, 9 Jan 2015 00:13:08 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:64067 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750709AbbAIFNH (ORCPT ); Fri, 9 Jan 2015 00:13:07 -0500 Received: by mail-pa0-f50.google.com with SMTP id bj1so16215317pad.9 for ; Thu, 08 Jan 2015 21:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2cGZJF6GPnYuPRCXz996HGn7HaGi7+CudJn0Xx4KgmE=; b=hKznHHu9EQcarxOEVOWev5o8CDltNvkX++DtqMsBHmIM925kaaepzBflULrmR0nPAu KmyVAPCHPaYRj9bS1Itc0vdZfp0Zt+N39z60wCAdyFkBAWEFT6oWwjEOG1L9D/wy8gio 4aEMbtz8Lb2K96IH2eOUGWRa4i7oaHyXwSuC1GFSKfwwUf6mdeywaQ8th+HiK85qtdX+ Zje83ZbjI/o9XPOc/HMhWfgHHl7cbyYQrpC1/CPRO7KcC4bW1x+HeJo2nbWo6nVGLN59 TYAomDvUb+CdoOPc2j+AI92dNOPkX/mBFo0UvWUEcYY3qK2r2HFQ+jz9l6xOgLgUCzZW WXmw== X-Received: by 10.70.41.177 with SMTP id g17mr20671288pdl.103.1420780386053; Thu, 08 Jan 2015 21:13:06 -0800 (PST) Received: from cdac.hyderabad.cdac.in ([196.12.45.164]) by mx.google.com with ESMTPSA id ns6sm5763053pbb.77.2015.01.08.21.13.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Jan 2015 21:13:04 -0800 (PST) From: Varka Bhadram X-Google-Original-From: Varka Bhadram To: linux-gpio@vger.kernel.org Cc: linus.walleij@linaro.org, Varka Bhadram , Varka Bhadram Subject: [PATCH RESEND gpio] gpio-amd8111: check ioport_map return value Date: Fri, 9 Jan 2015 10:38:51 +0530 Message-Id: <1420780131-6984-1-git-send-email-varkab@cdac.in> X-Mailer: git-send-email 1.7.9.5 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Varka Bhadram ioport_map() may fail. Its safe to check the return value. Signed-off-by: Varka Bhadram --- drivers/gpio/gpio-amd8111.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpio/gpio-amd8111.c b/drivers/gpio/gpio-amd8111.c index d3d2d10..2c4d9ab 100644 --- a/drivers/gpio/gpio-amd8111.c +++ b/drivers/gpio/gpio-amd8111.c @@ -213,6 +213,11 @@ found: goto out; } gp.pm = ioport_map(gp.pmbase + PMBASE_OFFSET, PMBASE_SIZE); + if (!gp.pm) { + dev_err(&pdev->dev, "Couldn't map io port into io memory\n"); + err = -ENOMEM; + goto out; + } gp.pdev = pdev; gp.chip.dev = &pdev->dev;