From patchwork Tue Jul 26 15:19:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9248329 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 4660660757 for ; Tue, 26 Jul 2016 15:19:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36BD326D08 for ; Tue, 26 Jul 2016 15:19:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B776272AA; Tue, 26 Jul 2016 15:19:58 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 D4B3B26D08 for ; Tue, 26 Jul 2016 15:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754318AbcGZPT5 (ORCPT ); Tue, 26 Jul 2016 11:19:57 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:35692 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799AbcGZPT5 (ORCPT ); Tue, 26 Jul 2016 11:19:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=8GKUBwcw8Kbuzm7Dgs4BuK0Xs1wn4t1bOsdRWcwKGLg=; b=MJ4MWSlRRTeprn bpil3PAst3Q4ZdEO3MwKP3rBhZ7wDr8LrdrKO4H+PUS8CgBMAQU4hrYGnTmJTaqwMSACUnq9sWMr1 NdEW6KtPnmJ0yKC/Bu3XQOdwWj8Vvv8BF+yyQqYJiAbNDb27LVpL1OXne3/etPxv1drMabuM2sC5J g++UPRvkv8cr9coiDi17KTvCAEloK7img0CKIZEyYZFi0hEQgM/O13xCbNViV6V14KERoPhkbcA/5 LCNgkU+Z8EAB7HhUi00VdI0TVl9l1HAoW/CzwNXuJIW9upljMx3Os3fq8y6Mf1LQBKrZHBjGawFmu 1yGblnWVDLBKqc7SScaQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:37484 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bS49D-003SLD-EO; Tue, 26 Jul 2016 15:19:55 +0000 From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH] hwmon: (tmp102) Improve error handling Date: Tue, 26 Jul 2016 08:19:48 -0700 Message-Id: <1469546388-29907-4-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1469546388-29907-1-git-send-email-linux@roeck-us.net> References: <1469546388-29907-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_add_action_or_reset() instead of devm_add_action(), and check its return code. Signed-off-by: Guenter Roeck --- drivers/hwmon/tmp102.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index a942a2574a4d..8479ac5eb853 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -227,7 +227,9 @@ static int tmp102_probe(struct i2c_client *client, tmp102->config_orig = regval; - devm_add_action(dev, tmp102_restore_config, tmp102); + err = devm_add_action_or_reset(dev, tmp102_restore_config, tmp102); + if (err) + return err; regval &= ~TMP102_CONFIG_CLEAR; regval |= TMP102_CONFIG_SET;