From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759585AbcHaJNA (ORCPT ); Wed, 31 Aug 2016 05:13:00 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:43353 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756559AbcHaJM6 (ORCPT ); Wed, 31 Aug 2016 05:12:58 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Wed, 31 Aug 2016 10:13:05 +0100 From: Charles Keepax To: Lee Jones CC: , Subject: Re: [PATCH] mfd: arizona: Add sensible return value to some error paths Message-ID: <20160831091305.GA21682@localhost.localdomain> References: <1470994047-1211-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> <20160831084327.GA27357@dell> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160831084327.GA27357@dell> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608310116 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 31, 2016 at 09:43:27AM +0100, Lee Jones wrote: > On Fri, 12 Aug 2016, Charles Keepax wrote: > > > There are some cases in arizona_dev_init, such as where we don't > > recognise the chip ID, in which we head to the error path without > > setting a sensible error code in ret. This would lead to the chip > > silently failing probe, as it would still return 0. Fix this up by > > adding appropriate sets of the return value. > > > > Signed-off-by: Charles Keepax > > --- > > drivers/mfd/arizona-core.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c > > index e4f97b3..34a2c26 100644 > > --- a/drivers/mfd/arizona-core.c > > +++ b/drivers/mfd/arizona-core.c > > @@ -1121,6 +1121,7 @@ int arizona_dev_init(struct arizona *arizona) > > break; > > default: > > dev_err(arizona->dev, "Unknown device ID: %x\n", reg); > > + ret = -EINVAL; > > -EINVAL doesn't seem right here. > > -ENODEV perhaps? > Yeah that does seem better, I will fire out another version. Thanks, Charles