From patchwork Fri Sep 9 08:31:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 667932 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 3sVr7n3BJdz9ryv for ; Fri, 9 Sep 2016 18:33:25 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbcIIIdX (ORCPT ); Fri, 9 Sep 2016 04:33:23 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56176 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbcIIIdW (ORCPT ); Fri, 9 Sep 2016 04:33:22 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1biHFQ-0006R8-7m; Fri, 09 Sep 2016 08:33:20 +0000 From: Colin King To: Linus Walleij , Alexandre Courbot , linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] gpio: pca953x: initialize ret to zero to avoid returning garbage Date: Fri, 9 Sep 2016 09:31:54 +0100 Message-Id: <20160909083154.26442-1-colin.king@canonical.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Colin Ian King ret is not initialized so it contains garbage. Ensure garbage is not returned in the case that pdata && pdata->teardown is false by initializing ret to 0. Signed-off-by: Colin Ian King --- drivers/gpio/gpio-pca953x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index cbe2824..52f3d5c 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -845,7 +845,7 @@ static int pca953x_remove(struct i2c_client *client) { struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev); struct pca953x_chip *chip = i2c_get_clientdata(client); - int ret; + int ret = 0; if (pdata && pdata->teardown) { ret = pdata->teardown(client, chip->gpio_chip.base,