Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbdGYK3S (ORCPT ); Tue, 25 Jul 2017 06:29:18 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:38343 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbdGYK3R (ORCPT ); Tue, 25 Jul 2017 06:29:17 -0400 MIME-Version: 1.0 In-Reply-To: <20170725091012.3hpxihekht2j35xb@dell> References: <1500506426-3047-1-git-send-email-rajmohan.mani@intel.com> <1500506426-3047-2-git-send-email-rajmohan.mani@intel.com> <20170720090300.ayx5pz5l4yntefpt@dell> <6F87890CF0F5204F892DEA1EF0D77A59725DD60A@FMSMSX114.amr.corp.intel.com> <20170725091012.3hpxihekht2j35xb@dell> From: Andy Shevchenko Date: Tue, 25 Jul 2017 13:29:15 +0300 Message-ID: Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470 To: Lee Jones Cc: "Mani, Rajmohan" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , Linus Walleij , Alexandre Courbot , "Rafael J. Wysocki" , Len Brown , "sakari.ailus@linux.intel.com" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 855 Lines: 35 On Tue, Jul 25, 2017 at 12:10 PM, Lee Jones wrote: > On Fri, 21 Jul 2017, Mani, Rajmohan wrote: >> > On Wed, 19 Jul 2017, Rajmohan Mani wrote: >> > > + /* Force software reset */ >> > > + ret = regmap_write(regmap, TPS68470_REG_RESET, >> > TPS68470_REG_RESET_MASK); >> > > + if (ret < 0) >> > >> > Will 'if (!ret)' do? >> > >> >> We intend to check error conditions and bail out. So, if (ret < 0) works for this. > > Yes, 'if (!ret)' does that too. Did you mean if (ret) return ret; ? I briefly checked few ->read() and ->write() implementations and didn't find any evidence of positive numbers that can be returned. Documentation (kernel doc) doesn't shed a light on that. So, to me it sounds unspecified. So, for now (until documentation will be fixed) I would rely on if (ret < 0) -- With Best Regards, Andy Shevchenko