Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Tweak failure case for L...



details:   https://anonhg.NetBSD.org/src/rev/05f3301f5b47
branches:  trunk
changeset: 797443:05f3301f5b47
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jul 17 20:37:01 2014 +0000

description:
Tweak failure case for Linux firmware API.

request_firmware is guaranteed to yield null on failure;
release_firmware on null is guaranteed to be a no-op.

diffstat:

 sys/external/bsd/drm2/include/linux/firmware.h |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 48c9e0ffd318 -r 05f3301f5b47 sys/external/bsd/drm2/include/linux/firmware.h
--- a/sys/external/bsd/drm2/include/linux/firmware.h    Thu Jul 17 19:58:18 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/firmware.h    Thu Jul 17 20:37:01 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firmware.h,v 1.3 2014/07/16 20:59:58 riastradh Exp $   */
+/*     $NetBSD: firmware.h,v 1.4 2014/07/17 20:37:01 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -76,6 +76,7 @@
 fail1: firmware_free(fw->data, fw->size);
 fail0: KASSERT(ret);
        kmem_free(fw, sizeof(*fw));
+       *fwp = NULL;
        return ret;
 }
 
@@ -83,8 +84,10 @@
 release_firmware(const struct firmware *fw)
 {
 
-       firmware_free(fw->data, fw->size);
-       kmem_free(__UNCONST(fw), sizeof(*fw));
+       if (fw != NULL) {
+               firmware_free(fw->data, fw->size);
+               kmem_free(__UNCONST(fw), sizeof(*fw));
+       }
 }
 
 #endif  /* _LINUX_FIRMWARE_H_ */



Home | Main Index | Thread Index | Old Index