Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp111140ybi; Fri, 24 May 2019 00:44:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBU37/fWw0XQumoiM125Dxq+0+n2Fdw1gXHgQMUpg30AX8gg5spWiwevzBf4xZxYwsvKGX X-Received: by 2002:a17:902:15c5:: with SMTP id a5mr105029368plh.39.1558683858388; Fri, 24 May 2019 00:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558683858; cv=none; d=google.com; s=arc-20160816; b=fccf3n0gbaOtLWwqti7MS1bqwI3uABIIiMXKAwuIU9JM724WtNY1rmnhG4pxne+dlt hGSg51Ot8fmB07EP4xGFA8JX3td9CzijaBgrW1B6Iz038byRNFiFvDlh/6D/EMlSbHxO n1BBTMb8IbR+AOTwrtNon8kmlqsH2I0q+qIFbdmKdeCTrosghfnsRi55oSNUspH7ww+p b5h7ETrVU5uLHQEdLPbx5ZgcTTEFJjLpV4i//e2jCc1RDplHE1WoP36/6SsHJa2Xb+I1 J9Mcx2jJQHl1BJBFGZ1qfEdajPauXUjeEblmWT2sV230EPjLi55AWgARtxXct5xu8nR1 3edQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:date:from :message-id:mime-version:subject:cc:to:references:in-reply-to; bh=tw0nfvZxMxRbGsQVHBmBRe4HKs61jQRelZr14CajbD8=; b=WWyDfSA+pYM/QnCRFi2+wsPSUIls9UPwaO5qpqNSz2ssBjPVxJTGdI5p1Fr2WzUhl3 A6cQfDOg4LVXa+J3RH4GDq/9PB04kO+BMNq7+1eTIAjq4l1znfvbd+6RsJr+W76QQECk Ghf64pwExEmNcFY3ZQkT3+1lBh1WDlGY37VTj3Nhz5xzenWTON8GBgeA/iawOK6IgRly FKVhEC/pfY2iwSKa+rYrljya97y6hLGpTILxIpZevCmRw7p8YXhI3v6snioK7OIuU6Dg To4upW7oehJHySodwDANwHS8HffGA5NNIf+IuJPpkyKHMxi/w6ONwe/n4fgdYUwxXJWt rqrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si2479377pjs.104.2019.05.24.00.43.57; Fri, 24 May 2019 00:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389056AbfEXHlD convert rfc822-to-8bit (ORCPT + 99 others); Fri, 24 May 2019 03:41:03 -0400 Received: from twhmllg3.macronix.com ([211.75.127.131]:58264 "EHLO TWHMLLG3.macronix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388960AbfEXHlD (ORCPT ); Fri, 24 May 2019 03:41:03 -0400 Received: from twhfmlp1.macronix.com (twhfm1p1.macronix.com [172.17.20.91]) by TWHMLLG3.macronix.com with ESMTP id x4O7euXb008092; Fri, 24 May 2019 15:40:56 +0800 (GMT-8) (envelope-from masonccyang@mxic.com.tw) Received: from MXML06C.mxic.com.tw (mxml06c.mxic.com.tw [172.17.14.55]) by Forcepoint Email with ESMTP id 2CB04E329FEC00A82B3B; Fri, 24 May 2019 15:40:57 +0800 (CST) In-Reply-To: <20190521104713.4b3a7769@xps13> References: <1558076001-29579-1-git-send-email-masonccyang@mxic.com.tw> <20190520143438.46248bfc@xps13> <20190521104713.4b3a7769@xps13> To: "Miquel Raynal" Cc: bbrezillon@kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, frieder.schrempf@kontron.de, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, richard@nod.at, vigneshr@ti.com, zhengxunli@mxic.com.tw Subject: Re: [PATCH v2] mtd: rawnand: Add Macronix NAND read retry support MIME-Version: 1.0 X-KeepSent: 2FAE9766:C611328F-48258404:0029BF19; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP4 SHF90 June 10, 2013 Message-ID: From: masonccyang@mxic.com.tw Date: Fri, 24 May 2019 15:40:57 +0800 X-MIMETrack: Serialize by Router on MXML06C/TAIWAN/MXIC(Release 9.0.1FP10 HF265|July 25, 2018) at 2019/05/24 PM 03:40:57, Serialize complete at 2019/05/24 PM 03:40:57 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-MAIL: TWHMLLG3.macronix.com x4O7euXb008092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, > > > > > > > + > > > > + ret = nand_get_features(chip, feature_addr, feature); > > > > + if (ret || feature[0] != mode) > > > > + pr_err("Failed to verify read retry moded:%d(%d)\n", > > > > + mode, feature[0]); > > > > > > if ret == 0 but feature[0] != mode, shouldn't you return an error? > > > > okay, will fix. > > > > > > > > > + } > > > > + > > > > + return ret; > > > > > > This will produce a Warning at compile time (ret may be used > > > uninitialized). Have you tested it? > > > > Tool chain I used is "gcc-arm-linux-gnueabi" and no Warning at compile > > time. > > What's the output of: > gcc-arm-linux-gnueabi -v > ? > Oops, it's gcc 4.8.3 20131111 and kind of obsolete. That's why no Warning at compile time. > > > > Patch it to: > > -----------------------------------------------------------------------------> > > static int macronix_nand_setup_read_retry(struct nand_chip *chip, int > > mode) > > { > > u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; > > int ret, feature_addr = ONFI_FEATURE_ADDR_READ_RETRY; > > > > if (chip->parameters.supports_set_get_features && > > test_bit(feature_addr, chip->parameters.set_feature_list) && > > test_bit(feature_addr, chip->parameters.get_feature_list)) { > > > > feature[0] = mode; > > ret = nand_set_features(chip, feature_addr, feature); > > ^ extra space, please be careful with the > typos, and run checkpatch.pl --strict before > sending patches. > > > if (ret) { > > pr_err("Failed to set read retry moded:%d\n", > > mode); > > goto err_out; > > } > > > > ret = nand_get_features(chip, feature_addr, feature); > > if (ret) { > > pr_err("Failed to get read retry moded:%d\n", > > mode); > > goto err_out; > > } else if (feature[0] != mode) { > > pr_err("Failed to verify read retry > > moded:%d(%d)\n", > > mode, feature[0]); > > return -EIO; > > That's not what I meant. You can keep the former condition but if !ret > then ret = -EIO for instance. > > > } > > } > > > > err_out: > > return ret; > > Again, do not jump to a single return call, directly do the return from > the point where you want to quit the function. > > The problem should be that ret may be used uninitialized, the compiler > should tell you that. got it and thanks for your review. > > Thanks, > Miqu?l best regards, Mason CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== ============================================================================ CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. =====================================================================