From patchwork Wed Dec 6 16:30:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 845252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="gA9gpZWH"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ysPGm688bz9s83 for ; Thu, 7 Dec 2017 03:30:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbdLFQaH (ORCPT ); Wed, 6 Dec 2017 11:30:07 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45935 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbdLFQaG (ORCPT ); Wed, 6 Dec 2017 11:30:06 -0500 Received: by mail-wr0-f193.google.com with SMTP id h1so4512320wre.12 for ; Wed, 06 Dec 2017 08:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=2sQt5j8DHdd0tVUoVm1RPmHyLykK09LAiuNzIJ6rsnc=; b=gA9gpZWHPdIXSWr76DAhmHUtEDFp5fzb7MQzP+aTtVci3mgcrhL8Q1muJypCWJQdXU ebTyKjO4f2qWNi9Fx4+37vCpVaGoAAP2ESWhCL12ZO5YpgXtOQhWPfY2Ec7zPJ16Hp1i hRrK1ObbcVDZ3AHQ9qxJC/7J8ZVBUjEMXRSjDNfBH/JQFNoEdTPBGnprEnn58cvepo8/ EOVjV05yq6RF8qf94zU8jYvfHj5rG3MxG5iq2gyFqWmzrYjTJjGhgPDvnu/ZeUXlkJGX 9w4wA5OIigZGBTBHP9j7VnfIk2aQ/5ZxUFqqparRYItQCfTkoK1v1CYYhcCsZqEoroJm sVKA== 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; bh=2sQt5j8DHdd0tVUoVm1RPmHyLykK09LAiuNzIJ6rsnc=; b=qOAeeIS3pU+PlhcyFAeHPO0XUatnsy3CvDb5YpNtqDzW+0qnWzRvYRgvG3nD5ch2gt NDSGSu38MIHoWs/7iwFSAaBV6nqXb3uveMLhNHt6IE6W1fCqDJrONM6uZBU0tevTjxD4 tRvkITSAs8JrUAYMWMJu0ATdZE6M4H40ebmh3ftrwi7VLfR7XobrvaBn8kgyzNjuSDFM pokQzS8If6KhKqEbfxFBU6y+IgYrMfEtVqoM9wI5h9XhUszLHjPwz+XnpCUn8Hyj8RRQ URGUwJcnvWiY7JOW/eds53lZwlSXzT9hxQ9GytfBYg5FH4cQO4CwLaQ8YIcwm41hrhzL YlvQ== X-Gm-Message-State: AJaThX4MziJtBoiBrlvU50hI5tMdnuyKCe4Gt66uOiIXJkFp4gqg5NGZ OFvw24/KlFxZAM1XzyCoJi08OWMPkvk= X-Google-Smtp-Source: AGs4zMaRg3qOmJKHMLUQUx8dMl3SFhj6OpJ+CHQF46s4HnQwRACUx7m7S9/44i5e+flM1oHEkbD1DA== X-Received: by 10.223.161.158 with SMTP id u30mr20776629wru.200.1512577805526; Wed, 06 Dec 2017 08:30:05 -0800 (PST) Received: from bgdev-debian.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c12sm3427225wmi.43.2017.12.06.08.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Dec 2017 08:30:04 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH] gpio: mockup: fix a return value check Date: Wed, 6 Dec 2017 17:30:02 +0100 Message-Id: <20171206163002.26742-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.15.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The return value of platform_device_register_resndata() on error is an error code converted to pointer with ERR_PTR(), not NULL. Check the return value correctly. Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing") Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mockup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index ea8c730d8af1..3a545ad17817 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -387,11 +387,11 @@ static int __init gpio_mockup_init(void) GPIO_MOCKUP_NAME, i, NULL, 0, &pdata, sizeof(pdata)); - if (!pdev) { + if (IS_ERR(pdev)) { gpio_mockup_err("error registering device"); platform_driver_unregister(&gpio_mockup_driver); gpio_mockup_unregister_pdevs(); - return -ENOMEM; + return PTR_ERR(pdev); } gpio_mockup_pdevs[i] = pdev;