[{"id":1761296,"web_url":"http://patchwork.ozlabs.org/comment/1761296/","msgid":"<20170831220846.35014f87@bbrezillon>","list_archive_url":null,"date":"2017-08-31T20:08:46","subject":"Re: [PATCH] mtd: mtdchar: handle a block that should be marked bad\n\tthat already is","submitter":{"id":63120,"url":"http://patchwork.ozlabs.org/api/people/63120/","name":"Boris Brezillon","email":"boris.brezillon@free-electrons.com"},"content":"On Thu, 31 Aug 2017 21:35:43 +0200\nUwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:\n\n> Otherwise at least /sys/class/mtd/mtdX/bad_blocks is increased each time\n> the same block is remarked as bad.\n> \n> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n> ---\n>  drivers/mtd/mtdchar.c | 5 +++++\n>  1 file changed, 5 insertions(+)\n> \n> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c\n> index 3568294d4854..049496a1d7a5 100644\n> --- a/drivers/mtd/mtdchar.c\n> +++ b/drivers/mtd/mtdchar.c\n> @@ -916,6 +916,11 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)\n>  \n>  \t\tif (copy_from_user(&offs, argp, sizeof(loff_t)))\n>  \t\t\treturn -EFAULT;\n> +\n> +\t\tif (mtd_block_isbad(mtd, offs))\n> +\t\t\t/* already done */\n> +\t\t\treturn 0;\n> +\n\nJust a matter of taste but I prefer to have comments before the\nconditional branch and not inside it, especially when the code chunk is\nnot enclosed into brackets.\n\n>  \t\treturn mtd_block_markbad(mtd, offs);\n>  \t\tbreak;\n\nThis break statement is redundant. Care to send another patch to fix\nthat?\n\n>  \t}","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"GQ6+uYEH\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"sEQOg8+l\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjtkx5fb7z9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 06:09:45 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnVmT-0007Mi-To; Thu, 31 Aug 2017 20:09:37 +0000","from merlin.infradead.org ([2001:8b0:10b:1231::1])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnVm6-0007MU-34\n\tfor linux-mtd@bombadil.infradead.org; Thu, 31 Aug 2017 20:09:14 +0000","from mail.free-electrons.com ([62.4.15.54])\n\tby merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnVm3-0004KU-6w\n\tfor linux-mtd@lists.infradead.org; Thu, 31 Aug 2017 20:09:12 +0000","by mail.free-electrons.com (Postfix, from userid 110)\n\tid 2E9B0209F1; Thu, 31 Aug 2017 22:08:46 +0200 (CEST)","from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id C774F20994;\n\tThu, 31 Aug 2017 22:08:45 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=/phLgvOrGrBieO0g00rkVpbagg2bBmp0L7FMAh+d020=;\n\tb=GQ6+uYEH5HXb1x\n\tFew++yGykoLuR6BqvOmtP2WSRd3H7JICvUsGUT+nh0mAGO9bSdu0gaADTQ7+e798HP6GNIVaTD3JP\n\taZYtNVUtxd6Mal+qrVrT+gESXbUduWPhxVMwitmKPnd6Mt2UJ89vhLWdMQRv9HrQF268GF13NgcUF\n\tF6RXNWxJAZrfj2MevjYQa3ZIPIdM5bzEVY9nMtRJhrUZFJjuwkU0JpFhffisEgzA+6DtE5zp/UrL0\n\tQRuQQlKOl6y3FS3Y7QLV1Z6reREy8Jdw4LPhmTpQqIdCDldqjJvSWSLfDTC7pqr9lN5K4kpUdHrie\n\tZ1aL6ar4JNFEom/j14IQ==;","v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=merlin.20170209;\n\th=Content-Transfer-Encoding:Content-Type:\n\tMIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender\n\t:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:\n\tList-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=ATSHV/J2T0sw04fLbYTp7UFkBiCrCrxAdqmHhNkyv+U=;\n\tb=sEQOg8+ldB4vfUGMS3mAaTqkQv\n\td+8Qv1QXS9v8GaDMEvQ+D54QKolNcFGnHpJdJIHr6TdDizxOQMGsf5QNytvsXjKwjrfe1er/WVI18\n\tNUQRnX1FiRZnOgu/Jhme/eC+jFArLvsSJMISHgrW1JGQj6Yeu7jWAf/+HPsOHnNXEhedoSmQyEIJr\n\twcDkTb0pqW4QiuN1g5+nPXILR25apB1QBCf2ofegTCehdytAxOPM0QuF6mqwtNQOpOTjWdtOuNBlW\n\tiucLmhKaYV480yJCM+Xq2crnxJMi4edUFOGLQJR/dYK42j5zoOiHGcEbDNVrhfMZIjlVXNF/Bakdf\n\tHn68pjDQ==;"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tmail.free-electrons.com","X-Spam-Level":"","X-Spam-Status":"No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT\n\tshortcircuit=ham autolearn=disabled version=3.4.0","Date":"Thu, 31 Aug 2017 22:08:46 +0200","From":"Boris Brezillon <boris.brezillon@free-electrons.com>","To":"Uwe =?utf-8?q?Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>","Subject":"Re: [PATCH] mtd: mtdchar: handle a block that should be marked bad\n\tthat already is","Message-ID":"<20170831220846.35014f87@bbrezillon>","In-Reply-To":"<20170831193543.27543-1-u.kleine-koenig@pengutronix.de>","References":"<20170831193543.27543-1-u.kleine-koenig@pengutronix.de>","X-Mailer":"Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)","MIME-Version":"1.0","X-Spam-Note":"CRM114 invocation failed","X-Spam-Score":"-1.9 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on merlin.infradead.org summary:\n\tContent analysis details:   (-1.9 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Richard Weinberger <richard@nod.at>, Marek Vasut <marek.vasut@gmail.com>,\n\tlinux-mtd@lists.infradead.org, kernel@pengutronix.de,\n\tCyrille Pitchen <cyrille.pitchen@wedev4u.fr>,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]