From patchwork Fri May 11 00:12:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10392649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C129A601A0 for ; Fri, 11 May 2018 00:14:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B922A28474 for ; Fri, 11 May 2018 00:14:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD4F628D38; Fri, 11 May 2018 00:14:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4255628474 for ; Fri, 11 May 2018 00:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbeEKAOi (ORCPT ); Thu, 10 May 2018 20:14:38 -0400 Received: from onstation.org ([52.200.56.107]:56944 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbeEKAMf (ORCPT ); Thu, 10 May 2018 20:12:35 -0400 Received: from xilitla.hsd1.wv.comcast.net (c-98-236-77-125.hsd1.wv.comcast.net [98.236.77.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id E7D731FAC; Fri, 11 May 2018 00:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1525997555; bh=FHfHSJKCgrq/JM9wkEND1dfR43IbO/pevVCq2Zop1ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFLv000qPaIjtXNfIB9KxixiENzHMCvm14CnM3vdS99oewhgq49ubwCcyrjdm+IN2 NqOwCFQqwMLgvSJE70ZrVPqXLy7qAZ37TO/CgLeziue0RzkOk+ySspe71LrU0qo6gb D4+XupFGi7uey+/Q42p2ujXsAg0JZNsV5GF9MEmQ= From: Brian Masney To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, drew.paterson@ams.com Subject: [PATCH v3 3/9] staging: iio: tsl2x7x: turn chip off if IIO device registration fails Date: Thu, 10 May 2018 20:12:17 -0400 Message-Id: <20180511001223.12378-4-masneyb@onstation.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180511001223.12378-1-masneyb@onstation.org> References: <20180511001223.12378-1-masneyb@onstation.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch turns the chip off if IIO device registration fails so that the error handling mirrors the device remove to make review easier in preparation for moving this driver out of staging. This patch also adds a missing error check in the call to tsl2x7x_chip_on() in tsl2x7x_probe(). Signed-off-by: Brian Masney --- drivers/staging/iio/light/tsl2x7x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index c1e726fc87b7..f5ca5ada0358 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -1657,10 +1657,13 @@ static int tsl2x7x_probe(struct i2c_client *clientp, } tsl2x7x_defaults(chip); - tsl2x7x_chip_on(indio_dev); + ret = tsl2x7x_chip_on(indio_dev); + if (ret < 0) + return ret; ret = iio_device_register(indio_dev); if (ret) { + tsl2x7x_chip_off(indio_dev); dev_err(&clientp->dev, "%s: iio registration failed\n", __func__); return ret;