Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932530Ab2JCRcd (ORCPT ); Wed, 3 Oct 2012 13:32:33 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:42368 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756344Ab2JCRcc (ORCPT ); Wed, 3 Oct 2012 13:32:32 -0400 MIME-Version: 1.0 In-Reply-To: <20121003170907.GA23473@ZenIV.linux.org.uk> References: <4FE8CED5.104@redhat.com> <20120625223306.GA2764@kroah.com> <4FE9169D.5020300@redhat.com> <20121002100319.59146693@redhat.com> <20121002221239.GA30990@kroah.com> <20121002222333.GA32207@kroah.com> <506C562E.5090909@redhat.com> <20121003170907.GA23473@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 3 Oct 2012 10:32:08 -0700 X-Google-Sender-Auth: 1M4SNs1OLXgIfHUk16mYP2QbXSg Message-ID: Subject: Re: udev breakages - was: Re: Need of an ".async_probe()" type of callback at driver's core - Was: Re: [PATCH] [media] drxk: change it to use request_firmware_nowait() To: Al Viro Cc: Mauro Carvalho Chehab , Ming Lei , Greg KH , Kay Sievers , Lennart Poettering , Linux Kernel Mailing List , Kay Sievers , Linux Media Mailing List , Michael Krufky , Ivan Kalvachev Content-Type: multipart/mixed; boundary=f46d0444ecf5fd8f8304cb2b0593 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5080 Lines: 87 --f46d0444ecf5fd8f8304cb2b0593 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Oct 3, 2012 at 10:09 AM, Al Viro wrote: > > + if (!S_ISREG(inode->i_mode)) > + return false; > + size = i_size_read(inode); > > Probably better to do vfs_getattr() and check mode and size in kstat; if > it's sufficiently hot for that to hurt, we are fucked anyway. > > + file = filp_open(path, O_RDONLY, 0); > + if (IS_ERR(file)) > + continue; > +printk("from file '%s' ", path); > + success = fw_read_file_contents(file, fw); > + filp_close(file, NULL); > > fput(file), please. We have enough misuses of filp_close() as it is... Ok, like this? Linus --f46d0444ecf5fd8f8304cb2b0593 Content-Type: application/octet-stream; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h7upr98f0 IGRyaXZlcnMvYmFzZS9maXJtd2FyZV9jbGFzcy5jIHwgNzMgKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrLQogMSBmaWxlIGNoYW5nZWQsIDcyIGluc2VydGlvbnMoKyks IDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9kcml2ZXJzL2Jhc2UvZmlybXdhcmVfY2xhc3Mu YyBiL2RyaXZlcnMvYmFzZS9maXJtd2FyZV9jbGFzcy5jCmluZGV4IDZlMjEwODAyYzM3Yi4uMzhm ZWFjNGFmOTkxIDEwMDY0NAotLS0gYS9kcml2ZXJzL2Jhc2UvZmlybXdhcmVfY2xhc3MuYworKysg Yi9kcml2ZXJzL2Jhc2UvZmlybXdhcmVfY2xhc3MuYwpAQCAtMjEsNiArMjEsNyBAQAogI2luY2x1 ZGUgPGxpbnV4L2Zpcm13YXJlLmg+CiAjaW5jbHVkZSA8bGludXgvc2xhYi5oPgogI2luY2x1ZGUg PGxpbnV4L3NjaGVkLmg+CisjaW5jbHVkZSA8bGludXgvZmlsZS5oPgogI2luY2x1ZGUgPGxpbnV4 L2xpc3QuaD4KICNpbmNsdWRlIDxsaW51eC9hc3luYy5oPgogI2luY2x1ZGUgPGxpbnV4L3BtLmg+ CkBAIC0zMyw2ICszNCw2NyBAQCBNT0RVTEVfQVVUSE9SKCJNYW51ZWwgRXN0cmFkYSBTYWlueiIp OwogTU9EVUxFX0RFU0NSSVBUSU9OKCJNdWx0aSBwdXJwb3NlIGZpcm13YXJlIGxvYWRpbmcgc3Vw cG9ydCIpOwogTU9EVUxFX0xJQ0VOU0UoIkdQTCIpOwogCisvKiBEb24ndCBpbmxpbmUgdGhpczog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ZWQgZGlyZWN0bHk/ICov CisJaWYgKCFmdy0+cHJpdikgeworCQl2ZnJlZShmdy0+ZGF0YSk7CisJCXJldHVybjsKKwl9CiAJ ZndfZnJlZV9idWYoZnctPnByaXYpOwogfQogCkBAIC03MDksNiArNzc1LDExIEBAIF9yZXF1ZXN0 X2Zpcm13YXJlX3ByZXBhcmUoY29uc3Qgc3RydWN0IGZpcm13YXJlICoqZmlybXdhcmVfcCwgY29u c3QgY2hhciAqbmFtZSwKIAkJcmV0dXJuIE5VTEw7CiAJfQogCisJaWYgKGZ3X2dldF9maWxlc3lz dGVtX2Zpcm13YXJlKGZpcm13YXJlLCBuYW1lKSkgeworCQlkZXZfZGJnKGRldmljZSwgImZpcm13 YXJlOiBkaXJlY3QtbG9hZGluZyBmaXJtd2FyZSAlc1xuIiwgbmFtZSk7CisJCXJldHVybiBOVUxM OworCX0KKwogCXJldCA9IGZ3X2xvb2t1cF9hbmRfYWxsb2NhdGVfYnVmKG5hbWUsICZmd19jYWNo ZSwgJmJ1Zik7CiAJaWYgKCFyZXQpCiAJCWZ3X3ByaXYgPSBmd19jcmVhdGVfaW5zdGFuY2UoZmly bXdhcmUsIG5hbWUsIGRldmljZSwK --f46d0444ecf5fd8f8304cb2b0593-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/